note 117510 added to function.list
| From: | mogwai512 | Date: | Sun, 21 Jun 2015 05:54:57 +0000 |
| Subject: | note 117510 added to function.list | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202918@lists.php.net to get a copy of this message | ||
I see many people offer solutions about the flipped order of the list construct. All you have to do
is this:
<?php
$info = array('coffee', 'brown', 'caffeine');
$a = list($a[0], $a[1], $a[2]) = $info;
var_dump($a);
?>
. . . and your info will be in the correct order. You can also just assign a new var to the list and
it will still work:
<?php
$info = array('coffee', 'brown', 'caffeine');
$b = list($a[0], $a[1], $a[2]) = $info;
var_dump($b);
?>
----
Server IP: 72.52.91.14
Probable Submitter: 70.113.10.39
----
Manual Page -- http://php.net/manual/en/function.list.php
Edit -- https://master.php.net/note/edit/117510
Del: integrated -- https://master.php.net/note/delete/117510/integrated
Del: useless -- https://master.php.net/note/delete/117510/useless
Del: bad code -- https://master.php.net/note/delete/117510/bad+code
Del: spam -- https://master.php.net/note/delete/117510/spam
Del: non-english -- https://master.php.net/note/delete/117510/non-english
Del: in docs -- https://master.php.net/note/delete/117510/in+docs
Del: other reasons-- https://master.php.net/note/delete/117510
Reject -- https://master.php.net/note/reject/117510
Search -- https://master.php.net/manage/user-notes.php