Re: Iteration through letter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 14 September 2006 12:26, Norbert Wenzel wrote:
> Hi,
>
> just for fun I tried the following code:
>
> <code>
> for($letter = 'A'; $letter <= 'Z'; ++$letter) {
> 	echo($letter . ' ');
> }
> </code>
>
> What surprised me was the output, which looked like this:
>
> A B C [...] Y Z AA AB AC [...] YY YZ
>
> I don't have any idea how these letters get printed out, so I'd
> appreciate any guesses or explanations.
>
> thanks,
> Norbert

This topic was discussed at quite some length before, and Rasmus helped us all 
understand it.  The reason that happens is the next "letter" after Z is AZ, 
which alphabetically is less than Z.  You could change your statement to use 
$letter < 'AZ'.  I think that would work.

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux