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]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php