note 10154 deleted from function.array-splice by jimw
| From: | jimw@php.net | Date: | Fri, 11 Jan 2002 21:50:27 +0000 |
| Subject: | note 10154 deleted from function.array-splice by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-24713@lists.php.net to get a copy of this message | ||
For those of you who are not familiar with PERL or other languages that have Splice commands, this
was not fully explained in the doc's explaination..
array_splice() will return the section of the array that was removed, if any.
So for instance
$a = array_shift($array);
Will pop the first element out of array and place it in $a, so will
list($a) = array_splice($array, 0, 1);
And for my purposes, there are many times when I like to go
list($a, $b) = array_splice($array, 0, 2);
popping multiple values at once ;)