Re: Feature Proposal: Allow letter decrementing

From: Date: Fri, 19 Jul 2013 09:18:39 +0000
Subject: Re: Feature Proposal: Allow letter decrementing
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-68188@lists.php.net to get a copy of this message
What's the intended use case for string increment / decrement? It just seems like madness to me, using mathematical operators with strings, producing seemingly arbitrary results in some circumstances (C -> B -> A -> NULL / False ?). Also what happens in other languages? Take for example German, in which ß comes after S, Ü after U, and so on. On Fri, Jul 19, 2013 at 9:59 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote: > Hi, > > I take a look at the code. > It does support [0-9] also. > > [yohgaki@dev tests]$ php -r "\$a = ' a10';for (\$i=0; \$i<10;\$i++) > var_dump(++\$a);" > string(4) " a11" > string(4) " a12" > string(4) " a13" > string(4) " a14" > string(4) " a15" > string(4) " a16" > string(4) " a17" > string(4) " a18" > string(4) " a19" > string(4) " a20" > > It sounds good to have string decrements. > > > 2013/7/19 Peter Lind <peter.e.lind@gmail.com> > > > Interesting to note that although Perl 6 is apparently capable of > > decrementing strings, it doesn't fully mirror the incrementing: > > > > http://feather.perl6.nl/syn/S03.html#line_516 > > > > Specifically: decrementing 'AAA' would not turn into 'ZZ' but would > error, > > according to that link > > > > Carry handle of decrements is more complex than increments. > It may be the reason. > > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > -- *Dan Cryer* 07590 698944 dan@dancryer.com +Dan <https://plus.google.com/101400775372325517263> @dancryer <http://www.twitter.com/dancryer>

« previous php.internals (#68188) next »