Re: Can I have If...Else inside a For Loop???

From: Date: Sat, 20 Oct 2001 04:46:29 +0000
Subject: Re: Can I have If...Else inside a For Loop???
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-71656@lists.php.net to get a copy of this message
AAAAaaaaarrrrrrgggghhhhh! I don't think I can say much else. Thanks so much for pointing that out David. ;-) .....Brad "David Pearson" <David@Pearson-Family.org> wrote in message news:003101c1591a$e00ec290$320110ac@david... > Could it be the semi colon at the end of the 'if' line, at '... $nChar = > 45); { ...' ? Looks like the if statement ends there, the ' { print > "OK."; } ' is a block on it's own and the 'else' is now out of > context. > > -----Original Message----- > From: Brad Melendy [mailto:brad@techkno.com] > Sent: Friday, October 19, 2001 8:03 PM > To: php-general@lists.php.net > Subject: [PHP] Can I have If...Else inside a For Loop??? > > > Hi All, > I'm stumped. I've got the following code: > > <?php > if(isSet($domain)) > { > for ( $counter=0; $counter <= strlen($domain); $counter++ ) > { > $nChar = ord(strtolower(substr($domain, $counter, 1))); > if (($nChar > 47 And $nChar < 58) or ($nChar > 96 And $nChar < 123) or > $nChar = 45); > { > print "OK."; > } > else > { > print "Not OK."; > } > } > } > ?> > > What's got me beat is that this code fails on the ELSE statement. Now, if I > comment out the ELSE statement, the code proceeds, I just don't get the > results I want when the coditions in IF statement are false. > > Anyone know what I'm doing wrong? It's as if you can't nest an IF/Else > under a FOR, but you can use just an IF. Thanks very much in advance. > > ....Brad > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#71656) next »