Re: [RFC] Generalize support of negative string offsets

From: Date: Wed, 10 Feb 2016 14:49:51 +0000
Subject: Re: [RFC] Generalize support of negative string offsets
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-91185@lists.php.net to get a copy of this message
On 10 February 2016 at 14:34, François Laupretre <francois@php.net> wrote: > Hi, > > I just added support for '[]' on strings and '{}' to the PR. > > Examples : > > $string[] = 'a'; // equivalent to : $string[strlen($string)] > > $string{} = 'a'; // For consistency Unless I'm missing some subtleties, that appears to just be a more confusing version of string concatenation. $string[] = 'a'; is equivalent to : $string .= 'a'; Is that correct? > This is not strictly in the scope of negative offsets. So, if you think it > must be part of a separate RFC, I will remove it. It seems unnecessary. Unless I've misunderstood what it does, it's just a complete duplication of functionality we already have (, in a way that is likely to confuse people, imo) and having duplicate functionality is not so good. At the very least it needs to be part of a separate vote option - but my opinion is that it's not needed at all, and should be left out entirely. cheers Dan

« previous php.internals (#91185) next »