php生成字符串增量,如ZA到ZB [重复]

This question already has an answer here:

I'm trying to generate strings in PHP like

"A" next "B"..."Z" next "ZA" next "ZB"..."ZZ" next "ZZA" next "ZZB"..."ZZZ" next "ZZZA"

Could someone help me with a method?

</div>

simply use increment operator -

$a = "A";
for($i=0;$i<100;$i++){
        echo $a++.' ';
}

just run this code to see the magic.

PHP follows Perl's convention when dealing with arithmetic operations on character variables and not C's. For example, in PHP and Perl $a = 'Z'; $a++; turns $a into 'AA', while in C a = 'Z'; a++; turns a into '[' (ASCII value of 'Z' is 90, ASCII value of '[' is 91). Note that character variables can be incremented but not decremented and even so only plain ASCII alphabets and digits (a-z, A-Z and 0-9) are supported. Incrementing/decrementing other character variables has no effect, the original string is unchanged.

PHP can count in letters.

For($i='A'; $i<='ZZZA'; $i++){
   Echo $i ."
";
}

https://3v4l.org/VgLi8