Re: [PHP] Why is some_function()[some_index] invalid syntax?

2008-01-14 Thread Richard Lynch
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

Re: [PHP] Why is some_function()[some_index] invalid syntax?

2008-01-11 Thread Zoltán Németh
2008. 01. 10, csütörtök keltezéssel 21.25-kor Jim Lucas ezt írta: Nathan Nobbe wrote: On Jan 10, 2008 11:00 PM, Arlen Christian Mart Cuss [EMAIL PROTECTED] 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

Re: [PHP] Why is some_function()[some_index] invalid syntax?

2008-01-11 Thread Nathan Nobbe
On Jan 11, 2008 3:45 AM, Zoltán Németh [EMAIL PROTECTED] wrote: and call it Java ;) or perhaps javascript :) function cool() { return [1, 2, 3]; } alert(cool()[0]); -nathan

Re: [PHP] Why is some_function()[some_index] invalid syntax?

2008-01-11 Thread Jochem Maas
Arlen Christian Mart Cuss schreef: 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 ';') because it's not valid syntax. strangely enough php is neither insert other language

Re: [PHP] Why is some_function()[some_index] invalid syntax?

2008-01-11 Thread Jim Lucas
Nathan Nobbe wrote: On Jan 11, 2008 3:45 AM, Zoltán Németh [EMAIL PROTECTED] wrote: and call it Java ;) or perhaps javascript :) function cool() { return [1, 2, 3]; } alert(cool()[0]); -nathan or Ruby -- Jim Lucas Some men are born to greatness, some achieve greatness,

Re: [PHP] Why is some_function()[some_index] invalid syntax?

2008-01-11 Thread Larry Garfield
On Friday 11 January 2008, Zoltán Németh wrote: So, make all your functions return objects, and have the object have a method called get or index or something like that that returns the index requested. :) Better yet, make everything an object: String, Numeric, Array, etc and call

Re: [PHP] Why is some_function()[some_index] invalid syntax?

2008-01-10 Thread Jim Lucas
Arlen Christian Mart Cuss 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 asked that question years ago. It was explained to me that php does

Re: [PHP] Why is some_function()[some_index] invalid syntax?

2008-01-10 Thread Casey
On Jan 10, 2008, at 8:00 PM, Arlen Christian Mart Cuss [EMAIL PROTECTED] 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

Re: [PHP] Why is some_function()[some_index] invalid syntax?

2008-01-10 Thread Nathan Nobbe
On Jan 10, 2008 11:00 PM, Arlen Christian Mart Cuss [EMAIL PROTECTED] 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 ';') thats hillarious, i literally brought this

Re: [PHP] Why is some_function()[some_index] invalid syntax?

2008-01-10 Thread Jim Lucas
Nathan Nobbe wrote: On Jan 10, 2008 11:00 PM, Arlen Christian Mart Cuss [EMAIL PROTECTED] 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 ';') thats hillarious, i

Re: [PHP] Why is some_function()[some_index] invalid syntax?

2008-01-10 Thread Nathan Nobbe
On Jan 11, 2008 12:25 AM, Jim Lucas [EMAIL PROTECTED] wrote: So, make all your functions return objects, and have the object have a method called get or index or something like that that returns the index requested. :) Better yet, make everything an object: String, Numeric, Array, etc i