tedd wrote:
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?
It's a bit of a quirk. "z"++ is "aa" and "aa" < "z". I would guess
this would loop until until just before "za" which would be "yz".
It's a bit like looping through the hexadecimal characters. You would
have the same effect. However instead of being base-16 with 0-9-a-f you
have base-26 using a-z.
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php