RE: [PHP] ($a = 'a'; $a <= 'z'; $a++) invalid?

From: Date: Thu, 14 Dec 2000 20:15:10 +0000
Subject: RE: [PHP] ($a = 'a'; $a <= 'z'; $a++) invalid?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-30354@lists.php.net to get a copy of this message
Hey Mark, That is odd considering this works just fine : $letter = 'a'; for ($a = 1; $a <= 26; $a++) { $foo[] = $letter++; } I don't see a difference in incrementing styles. > In two of the three components of the statement in question, you're treating > $a as a string variable ($a='a', and $a<='z'). In the third, > you're > treating it as an integer by attempting to increment it. > The result is, obviously, not intuitive. At the same time, I'm not > altogether sure how it would be appropriately corrected. (That is, what > *should" be one greater than "z"? The current behavior, apparently, is that > "aa" comes next, and "aa" is, alphabetically speaking, less than > "z"...)

« previous php.general (#30354) next »