>I see how this may work for strings and simple vectors, but what about this: > >$a = array(-1 => "foo", -2 => "bar"); echo $a[-1]; > >It should keep returning "foo", right? So then the question is - what >$array[-1] actually means?
Context would be the deciding factor, i.e. perhaps restrict the shortcut's applicability to only a positive sequence of numbers for an indexed array's keys, as follows: $a = array(10 => "pen", 11 => "heaven"); echo $a[-1]; // "heaven" >guess if somebody wrote an RFC on that it'd make understanding it >easier. I see that the patch seems to address just the string part - but >the subject also mentions arrays. I think making it clear would be helpful. I'd appreciate if someone possessing RFC "karma" would step forward and put together what should be a relatively simple proposal. And, it may be best to restrict it to just strings, too. You could call it: "RFC: Negative Indexing for Strings" Since Easen has generously provided the patch, writing this proposal should take max 10-20 minutes, if even that much. (And, if there were an RFC template that would make it even easier to do.) SL -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php