PHP 4.0 Bug #7385 Updated: 'letter counting' bug when counting a-z
| From: | lyric@php.net | Date: | Sun, 22 Oct 2000 15:20:50 +0000 |
| Subject: | PHP 4.0 Bug #7385 Updated: 'letter counting' bug when counting a-z | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-35782@lists.php.net to get a copy of this message | ||
ID: 7385
Updated by: lyric
Reported By: delme@jumeaux.bc.ca
Status: Closed
Bug Type: Scripting Engine problem
Assigned To:
Comments:
Applying ++ to a string essentially treats it like a base-26 number. It goes from 'a,b,c...
y,z,aa,ab,ac...' etc.
Try something like this. Maybe some else has a tidier way?
for ( $i='A'; $i!='AA'; $i++ )
print $i. '<br>';
Previous Comments:
---------------------------------------------------------------------------
[2000-10-21 21:13:14] delme@jumeaux.bc.ca
for ($i = 'A'; $i <= 'Z'; $i++) {
print $i. '<br>';
}
the above code *should* produce 26 letters, but instead it counts all the way from A to YZ.
A to ZZ counts from A to ZYZ, and so on.
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7385