Re: [PHP] Can I have If...Else inside a For Loop???
Oops, I spoke too soon. I wasn't getting the results I thought I was until I used "==" instead of "=" at the very end of my IF statement. Thanks very much for pointing that out. Brad "Brad Melendy" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > H. dunno about that. It's returning the results I'd expect as it is > now. If I pass a string with characters that don't match the IF's criteria, > I'm getting the ELSE statement's results. Thanks though. > > Brad > > "~~~I Leonid ~~" <[EMAIL PROTECTED]> wrote in message > 3bd15547.14743496@localhost">news:3bd15547.14743496@localhost... > > On Fri, 19 Oct 2001 21:46:29 -0700 impersonator of [EMAIL PROTECTED] (Brad > > Melendy) planted &I saw in php.general: > > > > >arrh! I don't think I can say much else. Thanks so > > >much for pointing that out David. ;-) > > > > > >.Brad > > > > > > > > >"David Pearson" <[EMAIL PROTECTED]> wrote in message > > >003101c1591a$e00ec290$320110ac@david">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:[EMAIL PROTECTED]] > > >> Sent: Friday, October 19, 2001 8:03 PM > > >> To: [EMAIL PROTECTED] > > >> Subject: [PHP] Can I have If...Else inside a For Loop??? > > >> > > >> > > >> Hi All, > > >> I'm stumped. I've got the following code: > > >> > > >> > >> 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); > > I'd also ^^put == here, or you NEVER get to else{ anyway > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Can I have If...Else inside a For Loop???
H. dunno about that. It's returning the results I'd expect as it is now. If I pass a string with characters that don't match the IF's criteria, I'm getting the ELSE statement's results. Thanks though. Brad "~~~I Leonid ~~" <[EMAIL PROTECTED]> wrote in message 3bd15547.14743496@localhost">news:3bd15547.14743496@localhost... > On Fri, 19 Oct 2001 21:46:29 -0700 impersonator of [EMAIL PROTECTED] (Brad > Melendy) planted &I saw in php.general: > > >arrh! I don't think I can say much else. Thanks so > >much for pointing that out David. ;-) > > > >.Brad > > > > > >"David Pearson" <[EMAIL PROTECTED]> wrote in message > >003101c1591a$e00ec290$320110ac@david">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:[EMAIL PROTECTED]] > >> Sent: Friday, October 19, 2001 8:03 PM > >> To: [EMAIL PROTECTED] > >> Subject: [PHP] Can I have If...Else inside a For Loop??? > >> > >> > >> Hi All, > >> I'm stumped. I've got the following code: > >> > >> >> 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); > I'd also ^^put == here, or you NEVER get to else{ anyway -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Can I have If...Else inside a For Loop???
On Fri, 19 Oct 2001 21:46:29 -0700 impersonator of [EMAIL PROTECTED] (Brad Melendy) planted &I saw in php.general: >arrh! I don't think I can say much else. Thanks so >much for pointing that out David. ;-) > >.Brad > > >"David Pearson" <[EMAIL PROTECTED]> wrote in message >003101c1591a$e00ec290$320110ac@david">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:[EMAIL PROTECTED]] >> Sent: Friday, October 19, 2001 8:03 PM >> To: [EMAIL PROTECTED] >> Subject: [PHP] Can I have If...Else inside a For Loop??? >> >> >> Hi All, >> I'm stumped. I've got the following code: >> >> > 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); I'd also ^^put == here, or you NEVER get to else{ anyway -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Can I have If...Else inside a For Loop???
arrh! I don't think I can say much else. Thanks so much for pointing that out David. ;-) .Brad "David Pearson" <[EMAIL PROTECTED]> wrote in message 003101c1591a$e00ec290$320110ac@david">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:[EMAIL PROTECTED]] > Sent: Friday, October 19, 2001 8:03 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Can I have If...Else inside a For Loop??? > > > Hi All, > I'm stumped. I've got the following code: > > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Can I have If...Else inside a For Loop???
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:[EMAIL PROTECTED]] Sent: Friday, October 19, 2001 8:03 PM To: [EMAIL PROTECTED] Subject: [PHP] Can I have If...Else inside a For Loop??? Hi All, I'm stumped. I've got the following code: 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Can I have If...Else inside a For Loop???
Hi All, I'm stumped. I've got the following code: 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]