Re: Re: Support negative indexes for arrays and strings
| From: | David Zülke | Date: | Tue, 04 Sep 2012 10:31:05 +0000 |
| Subject: | Re: Re: Support negative indexes for arrays and strings | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62785@lists.php.net to get a copy of this message | ||
On 03.09.2012, at 09:37, Jannik Zschiesche <hello@apfelbox.net> wrote:
> The main problem arises from the ambiguity for $array[-1] for arrays.
> But this is easily solvable: just introduce a slice operator.
>
> $array[:-1] and the ambiguity is gone.
That would return an array containing the last item as the sole member, not the last item itself.
David