Re: Stupid newbee question.

From: Date: Sat, 29 Jul 2000 01:24:57 +0000
Subject: Re: Stupid newbee question.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-8905@lists.php.net to get a copy of this message
Ed Warvel wrote: > > Can you put an if/else pair inside the if or else of an outer pair. In other > words could I do this: > > if (whatever){ > If (whatever){ > blah blah; > }Else{ > blah blah; > } > }else{ > If (whatever){ > blah blah; > }Else{ > blah blah; > } > } > > If the answer is yes and this should not cause any problems then I probably > am missing a comma or quote or something else that just doesn't cause a > problem until the code gets to the outer level else. If this doesn't work is > there a way around doing this, or maybe a different syntax I should be > using. I'm a Cold Fusion programmer and I know I can nest if/else pairs to > my hearts content (as long as I can keep track of the brackets) in that > language, but I'm very new to PHP so I'm wondering if it has different ways > of doing this sort of thing. You are allowed to nest if statements with one another. You would be in some seious hurt if you couldn't, IMO. I program in a number of languages C/C++/VB/Java/javaScript/Perl, they ALL allow nested if statements. They also allow nesting of any type of conditional if/switch/while/do. The only language that doesn't, that I know of, is Assembly, but then you don't have any of those conditionals:) Life is very different in assembly:) Sam

« previous php.general (#8905) next »