This sentence was highly misleading, since 'Z' + 1 doesn't actually return 'AA'. Changing a few more bits around it for sake of clarity.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@310451 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Nikola Smolenski 2011-04-24 09:38:02 +00:00
parent bf2236ece3
commit 557d9ad881

View file

@ -1569,10 +1569,10 @@ echo "Should be 4: " . $a . "<br />\n";
</para>
<para>
PHP follows Perl's convention when dealing with arithmetic operations
on character variables and not C's. For example, in Perl
<literal>'Z'+1</literal> turns into <literal>'AA'</literal>, while in C
<literal>'Z'+1</literal> turns into <literal>'['</literal>
( <literal>ord('Z') == 90</literal>, <literal>ord('[') == 91</literal> ).
on character variables and not C's. For example, in PHP and Perl
<literal>$a = 'Z'; $a++;</literal> turns <literal>$a</literal> into <literal>'AA'</literal>, while in C
<literal>a = 'Z'; a++;</literal> turns <literal>a</literal> into <literal>'['</literal>
(ASCII value of <literal>'Z'</literal> is 90, ASCII value of <literal>'['</literal> is 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.
<example>