On 03.09.2012, at 01:11, sle...@pipeline.com wrote: >> 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"
You clearly haven't thought this through. What if my code wants to check for the existance of an array index "-1", and it doesn't know what kind of array gets passed in? For an index "-1", a value would exist, and for a "sequential" array, it would exist as well. This is an insane can of worms.
smime.p7s
Description: S/MIME cryptographic signature