View Single Post

  #3 (permalink)  
Old 01-11-2008
Casey
 
Posts: n/a
Default Re: [PHP] Why is some_function()[some_index] invalid syntax?

On Jan 10, 2008, at 8:00 PM, Arlen Christian Mart Cuss <celtic@sairyx.org
> wrote:


> Hi there,
>
> 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 ';')
>
> Thanks,
> Arlen.


I've run into this problem. (It works in Javascript >.>)

While I don't know why, you could store it in a temporary variable or
use the list() language construct.

-Casey
Reply With Quote