Can I have If...Else inside a For Loop???
| From: | Brad Melendy | Date: | Sat, 20 Oct 2001 03:02:32 +0000 |
| Subject: | Can I have If...Else inside a For Loop??? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-71651@lists.php.net to get a copy of this message | ||
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