Understanding why php increments characters the way it does

PHP Reference: PHP follows Perl conventions when working with arithmetic operations on character variables, not C. For example, in PHP and Perl it $a = 'Z'; $a++;turns $ a into 'AA', and in C it a = 'Z'; a++;turns into '[' (ASCII value "Z" is 90, the ASCII value "[" is 91).

If PHP converts characters to ascii values ​​(provided) when working with arithmetic operations on characters, should it not print '[' instead of AA? Why and how does PHP increment characters the way they do?

+3
source share
1 answer

PHP ascii () ...

, "0" 0 , "0" 48.

$ php
<?php
echo "0" == 0 ; echo "\n";
echo "0" == 48 ; echo "\n";
1
+2

All Articles