|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-10-21 21:13 UTC] delme at jumeaux dot bc dot 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 15 03:00:01 2025 UTC |
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>';