for循环中递增字符有效,递减不?

Incrementing chars in for loop works, decrementing does not?

所以我在这段代码中做了一些练习和 运行(生成“1.项目 A”、“2.项目 B”等):

echo "\n<ol>";
for ($x='A'; $x<'G'; $x++){
    echo "<li>Item $x</li>\n";
}
echo "\n</ol>";

好奇,我试图做相反的事情(这会产生 Zs 的无限循环):

echo "\n<ol>";
for ($x = 'Z'; $x > 'M'; $x--){
    echo "<li>Item $x</li>\n";
}
echo "\n</ol>";

我错过了什么?

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 手册 link