Re: Iteration through letter
| From: | Ray Hauge | Date: | Thu, 14 Sep 2006 17:50:01 +0000 |
| Subject: | Re: Iteration through letter | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-241794@lists.php.net to get a copy of this message | ||
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