On 12 December 2013 12:02, Andrea Faulds <ajf@ajf.me> wrote:
> So I've written a patch which would change this. "aa" when decremented would
> be "z", and "b" when decremented would be "a". It also handles
> decrementing
> "a", which becomes "0". This creates an interesting new asymettry: {$a =
> "a"; $a--; $a++;} will result in $a being integer 1. I think it's better
> than the previous behaviour, though, which resulted in "b".
I wonder if we'd want to warn when 'a' decrements to 0, since it's a
somewhat unintuitive behaviour. (Also, since Perl will decrement 'a'
to -1 and Perl was the original inspiration, do we want to decrement
to -1 as well for consistency?)
> The diff is here:
> https://github.com/TazeTSchnitzel/php-src/compare/php:PHP-5.6...AlphanumericDecrement
>
> My aim is to try and get this into PHP 5.6, if people are interested.
> Thoughts?
I haven't looked closely at the diff yet, but +1 on the idea. We've
always documented that decrement doesn't work, so there shouldn't be a
BC concern there.
Adam