Re: Function-return-array idea

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

 



Stijn Leenknegt wrote:

> This is nice, but when I want one element of the returned array, I
> have to store the returned array into a variable and then call the
> variable. The next code example is my idea.
> 
> <?php
> echo getUserInformation($id)['naam'];
> ?>
> 
> Let's look further then this small example.
> 
> <?php
> echo $object->fetchObjects()[0]->method();
> ?>

Yeah, I like the idea.  I've often used that style out of habit, only to
have to revert to assigning the result to a variable etc. 
I don't know why it isn't supported by PHP, but I suspect it is related
to the type-concept. 


/Per Jessen, Zürich

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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