Re: Feature Proposal: Allow letter decrementing

From: Date: Fri, 19 Jul 2013 06:39:45 +0000
Subject: Re: Feature Proposal: Allow letter decrementing
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-68182@lists.php.net to get a copy of this message
On Thu, Jul 18, 2013 at 4:37 PM, Xinchen Hui <laruence@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

« previous php.internals (#68182) next »