有同学问了一个问题:
复制代码 代码如下:
for($i = 'A'; $i echo $i;
}
//输出是啥?
复制代码 代码如下:
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARAS…….
复制代码 代码如下:
PHP follows Perl's convention when dealing with arithmetic operations on character variables and not C's. For example, in Perl ‘Z'+1 turns into ‘AA', while in C ‘Z'+1 turns into ‘[‘ ( ord(‘Z') == 90, ord(‘[‘) == 91 ). Note that character variables can be incremented but not decremented and even so only plain ASCII characters (a-z and A-Z) are supported.
复制代码 代码如下:
$name = "laruence";
++$name; //将会是"laruencf"
复制代码 代码如下:
$name = "laruence";
--$name; //没有影响, 还是"laruence"