Re: Why is some_function()[some_index] invalid syntax?
| From: | Richard Lynch | Date: | Mon, 14 Jan 2008 18:33:31 +0000 |
| Subject: | Re: Why is some_function()[some_index] invalid syntax? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-267237@lists.php.net to get a copy of this message | ||
On Thu, January 10, 2008 10:00 pm, Arlen Christian Mart Cuss wrote:
> Why is it that if I try to evaluate an index of an array returned by a
> function immediately, a syntax error is produced? (unexpected '[',
> expecting ',' or ';')
Because PHP is not C.
It's language-design was chosen to not let you write complicated
expressions that only confuse beginners.
There was talk of letting this work on php-internals, but it was shot
down, as I recall...
Or perhaps not, but nobody actually submitted a patch to make it work,
so it's one of those "someday" features...
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?