Re: Array access on function returns
| From: | (Wietse Venema) | Date: | Sun, 20 Apr 2008 13:21:43 +0000 |
| Subject: | Re: Array access on function returns | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-37149@lists.php.net to get a copy of this message | ||
Kalle Sommer Nielsen:
> Hey Internals
>
> I've been wondering for quite some time why PHP doesn't allow you
> to access arrays when you assign it to a value like in Javascript:
In many languages you get such functionality for free, because their
parsers are written to accept:
expression '[' expression ']'
Thus, any expression that evaluates to an array can have '[]'.
Javascript, Perl and C are just a few examples.
The PHP parser is different. It requires a variable to the left of
'['. Changing this is not as simple as changing one or two YACC
rules.
Wietse