Hmmmm....this is definately not expected....
| From: | moxford at surfmetro dot com | Date: | Mon, 02 Apr 2001 19:58:03 +0000 |
| Subject: | Hmmmm....this is definately not expected.... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-46674@lists.php.net to get a copy of this message | ||
While trying to print A-Z...
This spews A-Z, then AA-YZ, then stops, most likely from a timeout.
<?php
for ($x = 'A'; $x <= 'Z'; $x++)
{
echo "$x\n";
}
?>
This works as expected.
<?php
for ($y = 0, $x = 'A'; $x <= 'Z', $y < 26; $y++, $x++)
{
echo "$x\n";
}
?>
Most likely the first one hits the execution time-limit, and that's
why it finally stops. What I can't figure out is why it would do
A-Z and then start over at AA since the $x <= 'Z' should kill the
loop. Removing the single quotes (trying for ASCII values)
doesn't fix the problem...
-Mike