When is "z" != "z" ?
| From: | tedd | Date: | Sun, 04 Jun 2006 17:38:57 +0000 |
| Subject: | When is "z" != "z" ? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-237357@lists.php.net to get a copy of this message | ||
Hi gang:
Here's your opportunity to pound me again for not knowing the basics of php.
I vaguely remember something like this being discussed a while back, but can't find the
reference.
In any event, if one uses --
for ($i="a"; $i<"z"; $i++)
{
echo($i);
}
-- it stops at "y"
But, if you use --
for ($i="a"; $i<="z"; $i++)
{
echo($i);
}
-- it prints considerably more characters after "z" than what one would normally expect --
why is that?
Just stopping at "z" would seem to make more sense, wouldn't it? After all, when $i =
"z" in the first expression, then wouldn't $i be equal to "z" in the second
expression and thus halt the operation?
What am I missing here?
Thanks.
tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com