PHP is not C, so 'a' + 1
is not 'b'
.
'a'
in a numeric context is 0
, and 0+1 = 1
.
php> echo (int)'a';
0
The fact that the postfix/prefix increment operators do work like if it was a C char seems to be a nasty "feature" of PHP. Especially since the decrement operators are a no-op in this case.
When you increment 'z'
it gets even worse:
php> $a = 'z';
php> echo ++$a
aa
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…