On Thu, Jul 18, 2013 at 4:37 PM, Xinchen Hui <larue...@gmail.com> wrote:
>> Hello,
>>
>> Does anybody understand the rules behind the string incrementation? What's
>> the explanation of following behaviour?
>>
>> '$x="ZZ";$x++;var_dump($x);' returns string(3) "AAA"
>> '$x=" ZZ";$x++;var_dump($x);' returns string(3) " AA"
>>
>
> see http://www.php.net/manual/en/language.operators.increment.php

I don't see any explanation for the examples above. Documentation says:

[...] For example, in PHP and Perl $a = 'Z'; $a++; turns $a into 'AA' [...]

I'd expect " ZZ" to become " AAA" rather than " AA". I'm not sure if
it's a bug in documentation, in code. Probably nobody can even
distinguish if it's a bug or feature.

Mateusz Kocielski

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to