note 39640 deleted from control-structures.for by danbrown

From: Date: Mon, 07 Dec 2009 16:08:17 +0000
Subject: note 39640 deleted from control-structures.for by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-163662@lists.php.net to get a copy of this message
Note Submitter: hayes029 at bama dot ua dot edu ---- For the purposes of outputing the alphabet, <?php 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, <?php 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: <?php for ($i="A"; $i != "AA"; $i++) echo "$i<br>"; ?>

« previous php.notes (#163662) next »