Re: [RFC] Generalize support of negative string offsets
| From: | Nikita Popov | 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 internals+get-91037@lists.php.net to get a copy of this message | ||
On Sat, Jan 23, 2016 at 4:45 PM, François Laupretre <francois@php.net>
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