Re: RFC - Array slice syntactic sugar
| From: | Alex Bowers | Date: | Fri, 20 Mar 2015 20:27:51 +0000 |
| Subject: | Re: RFC - Array slice syntactic sugar | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85325@lists.php.net to get a copy of this message | ||
On 20 March 2015 at 20:10, Sean Coates <sean@seancoates.com> wrote:
> That’s no different than
@ being invalid because it’s
> already in use.
The syntax would be [*from:to], which would currently throw a parse error
(since asterisk is required to be placed between two numbers), so this
would be different.
Alternatively, an underscore could be used
This would then look like [_from:to]
Also, another option would be to not use the square bracket syntax at all,
and move towards angled brackets for positional indexing.
This would then be $array<1:2> to get items in positions 1 and 2.