note 39640 added to control-structures.for
| From: | hayes029 at bama dot ua dot edu | Date: | Thu, 05 Feb 2004 16:16:24 +0000 |
| Subject: | note 39640 added to control-structures.for | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64695@lists.php.net to get a copy of this message | ||
For the purposes of outputing the alphabet,
for ($i="A"; $i <= "Z"; $i++) echo "$i<br>";
will actually output A-Z, then begin again with AA, AB, etc. until it finishes with YZ. Similarly,
for ($i="A"; $i <= "ZZ"; $i++) echo "$i<br>";
will output A-Z, AA, AB... ZZ, then begin again with AAA, AAB, AAC... up to ZYZ.
Thus an alternative to timrosseel's example for outputting the alphabet is:
for ($i="A"; $i != "AA"; $i++) echo "$i<br>";
----
Manual Page -- http://www.php.net/manual/en/control-structures.for.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39640
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39640&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39640&report=yes
Search -- http://master.php.net/manage/user-notes.php