note 10154 added to array_splice
| From: | Jesse at bend dot com | Date: | Fri, 15 Dec 2000 21:11:05 +0000 |
| Subject: | note 10154 added to array_splice | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8767@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 ;)
http://www.php.net/manual/function.array-splice.php