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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 10, 2008 11:00 PM, Arlen Christian Mart Cuss <celtic@xxxxxxxxxx>
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 up at the office like 2 days ago.
ill tell you why its really lame (imho), because php5 supports syntax
like this:
function someFunc() {
  return date_create();
}
echo someFunc()->format('Y-m-d');

that is, it allows you to chain a method invocation to the invocation of a
function
if the function returns an object.

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux