note 13571 modified in function.array.php by zak
| From: | zak@php.net | Date: | Fri, 22 Jun 2001 17:19:28 +0000 |
| Subject: | note 13571 modified in function.array.php by zak | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14564@lists.php.net to get a copy of this message | ||
[Editor's Note: Use
list ($single_var) = myarrayfunc();
list (,,,$single_var2) = myarrayfunc();
--jag@php.net]
I come from a perl background, and in perl there is a way to get only one element from a function
that returns an array. example (in perl):
$single_var = (myarrayfunc())[0] or
$single_var2 = (myarrayfunc())[3] etc...
Is there something like this in PHP?
Thanks.
http://www.php.net/manual/function.array.php.php