note 124440 added to language.types.array

From: Date: Wed, 27 Nov 2019 05:25:54 +0000
Subject: note 124440 added to language.types.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-213260@lists.php.net to get a copy of this message
<?php function getArray() { return array(1, 2, 3); } // on PHP 5.4 $secondElement = getArray()[1]; // previously $tmp = getArray(); $secondElement = $tmp[1]; // or list(, $secondElement) = getArray(); ?> Here list(, $secondElement) = getArray(); and list($secondElement) = getArray(); is the same thing so you can avoid the "comma" to avoid the confusion. ---- Server IP: 208.43.231.9 Probable Submitter: 185.85.3.168 (proxied: 103.232.103.179) ---- Manual Page -- http://php.net/manual/en/language.types.array.php Edit -- https://master.php.net/note/edit/124440 Del: integrated -- https://master.php.net/note/delete/124440/integrated Del: useless -- https://master.php.net/note/delete/124440/useless Del: bad code -- https://master.php.net/note/delete/124440/bad+code Del: spam -- https://master.php.net/note/delete/124440/spam Del: non-english -- https://master.php.net/note/delete/124440/non-english Del: in docs -- https://master.php.net/note/delete/124440/in+docs Del: other reasons-- https://master.php.net/note/delete/124440 Reject -- https://master.php.net/note/reject/124440 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#213260) next »