Re: [RFC] Generalize support of negative string offsets

From: Date: Sun, 31 Jan 2016 22:03:04 +0000
Subject: Re: [RFC] Generalize support of negative string offsets
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Sat, Jan 23, 2016 at 4:45 PM, François Laupretre <[email protected]>
wrote:

> Hi,
>
> Starting discussion about https://wiki.php.net/rfc/negative-string-offsets
>
> Please read and comment.
>

Just dropping by with a +1 on this proposal. Consistent support is always
good.

The only concern I have is that support of negative indexing will break
symmetry with (proper) arrays, where we cannot support negative indexing.
I.e. this may lead to "Why can I write $str[-1] to get the last character
in a string, but not $array[-1] to get the last element in an array?"
However this is unlikely to be a significant issue. (I do however play with
the thought of reutilizing the obsolete {} indexing syntax to act as offset
indexing instead.)

Nikita


Thread (57 messages)

« previous php.internals (#91037) next »