Re: Support negative indexes for arrays and strings

From: Date: Fri, 31 Aug 2012 13:24:37 +0000
Subject: Re: Support negative indexes for arrays and strings
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-62607@lists.php.net to get a copy of this message
On Fri, Aug 31, 2012 at 3:14 PM, Rasmus Schultz <rasmus@mindplay.dk> wrote: > Having thought about this for a while, I think this is a bad idea - here's > why: > > $array = array(1001, 1002, 1003, 1004); > > $number = $array[-1]; // => 1004 > > $number[-1] = 1005; > > $number = $array[-1]; // => ???? > > Obviously, the last statement must return 1005, since otherwise that > value would be inaccessible. > > maybe you wanted to write $array[-1] = 1005; instead of $number[-1] = 1005; ? otherwise I can't see the problem that you are mentioning. could you clarify? -- Ferenc Kovács @Tyr43l - http://tyrael.hu

« previous php.internals (#62607) next »