RE: [PHP] Letters in Loops
| From: | phpninja | Date: | Thu, 23 Mar 2006 15:20:50 +0000 |
| Subject: | RE: [PHP] Letters in Loops | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-232452@lists.php.net to get a copy of this message | ||
Hello,
for($i=A;$i<=Z;$i++) {
if ($i == "ZZ") { break; }
echo "$i";
}
regards,
phpninja
-----Original Message-----
From: Ben Miller [*mailto:benipmiller@comcast.net*
<benipmiller@comcast.net>]
Sent: Thursday, March 23, 2006 7:08 AM
To: php-general@lists.php.net
Subject: [PHP] Letters in Loops
In trying to make an alpha list, using the following:
for($i=A;$i<=Z;$i++) {
echo "$i";
}
Produces:
A
B
C...
X
Y
Z
AA
AB
AC...
AX
AY
AZ... all the way to YZ.
What am I doing wrong that it's not stopping at just plain old "Z", without
moving on to "AA" and continuing?
--
PHP General Mailing List (*http://www.php.net/* <http://www.php.net/>) To
unsubscribe, visit: *http://www.php.net/unsub.php*<http://www.php.net/unsub..php>