>
> That's why I propose a new syntax such as $thing[@0], $thing[@-1]


I have to agree that a new syntax will be required by this.

On 20 March 2015 at 18:17, Rowan Collins <rowan.coll...@gmail.com> wrote:

> Leigh wrote on 20/03/2015 16:17:
>
>>
>> For $thing[-1] I think this only works for strings (and I have this
>> implemented, should probably RFC it) https://github.com/lt/php-src/
>> tree/string_negative_offset
>>
>> $thing[-1:] is in scope for arrays though
>>
>>
> Why? Getting the last value of an array is just as useful as getting the
> last character of a string.
>
> It doesn't work *with that syntax*, because -1 is a valid key, just as
> $thing[0] can't mean "first value of array" because it already means "value
> with key 0". That's why I propose a new syntax such as $thing[@0],
> $thing[@-1], etc.
>
> Regards,
> --
> Rowan Collins
> [IMSoP]
>

Reply via email to