note 80847 added to ref.array
| From: | Casy at osu1 dot php dot net | Date: | Sun, 03 Feb 2008 20:32:57 +0000 |
| Subject: | note 80847 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135748@lists.php.net to get a copy of this message | ||
Please forgive me for asking a question but this has been bugging me FOREVER!
When a function returns an array, how do I access it directly instead of setting a variable to it
and accessing the variable?
Instead of
$a=mysqli_fetch_array($a);return$a[0];
I want to do
return mysqli_fetch_array($a)[0];
But PHP has a compile error when I do that x_x
----
Server IP: 64.71.164.2
Probable Submitter: 67.53.37.218
----
Manual Page -- http://www.php.net/manual/en/ref.array.php
Edit -- https://master.php.net/note/edit/80847
Del: integrated -- https://master.php.net/note/delete/80847/integrated
Del: useless -- https://master.php.net/note/delete/80847/useless
Del: bad code -- https://master.php.net/note/delete/80847/bad+code
Del: spam -- https://master.php.net/note/delete/80847/spam
Del: non-english -- https://master.php.net/note/delete/80847/non-english
Del: in docs -- https://master.php.net/note/delete/80847/in+docs
Del: other reasons-- https://master.php.net/note/delete/80847
Reject -- https://master.php.net/note/reject/80847
Search -- https://master.php.net/manage/user-notes.php