note 92860 added to functions.returning-values
| From: | TristanLaurillard at osu1 dot php dot net | Date: | Wed, 12 Aug 2009 07:23:38 +0000 |
| Subject: | note 92860 added to functions.returning-values | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159361@lists.php.net to get a copy of this message | ||
Coming from a javascript background,
I am surprised that:
<?PHP
function a()
{
return array('alpha', 'beta', 'gamma');
}
$b = a();
echo $b[0]; // returns: alpha
// BUT:
echo a()[0]; // returns an error !
?>
Or is there perhaps a good reason for this?
----
Server IP: 216.235.13.26
Probable Submitter: 24.84.57.25
----
Manual Page -- http://www.php.net/manual/en/functions.returning-values.php
Edit -- https://master.php.net/note/edit/92860
Del: integrated -- https://master.php.net/note/delete/92860/integrated
Del: useless -- https://master.php.net/note/delete/92860/useless
Del: bad code -- https://master.php.net/note/delete/92860/bad+code
Del: spam -- https://master.php.net/note/delete/92860/spam
Del: non-english -- https://master.php.net/note/delete/92860/non-english
Del: in docs -- https://master.php.net/note/delete/92860/in+docs
Del: other reasons-- https://master.php.net/note/delete/92860
Reject -- https://master.php.net/note/reject/92860
Search -- https://master.php.net/manage/user-notes.php