note 107810 added to function.array-pop
| From: | qeremy | Date: | Wed, 07 Mar 2012 11:26:10 +0000 |
| Subject: | note 107810 added to function.array-pop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186518@lists.php.net to get a copy of this message | ||
For the sake of array_unshift()
:)
<?php
function array_unpop(&$arr) {
$args = func_get_args(); unset($args[0]);
$tarr = array();
foreach ($args as $arg) {
$tarr[] = $arg;
}
$arr = array_merge($arr, $tarr);
}
$queue = array("orange", "banana");
array_unpop($queue, "apple", "raspberry");
print_r($queue);
?>
Array
(
[0] => orange
[1] => banana
[2] => apple
[3] => raspberry
)
----
Server IP: 69.147.83.197
Probable Submitter: 194.27.149.90
----
Manual Page -- http://www.php.net/manual/en/function.array-pop.php
Edit -- https://master.php.net/note/edit/107810
Del: integrated -- https://master.php.net/note/delete/107810/integrated
Del: useless -- https://master.php.net/note/delete/107810/useless
Del: bad code -- https://master.php.net/note/delete/107810/bad+code
Del: spam -- https://master.php.net/note/delete/107810/spam
Del: non-english -- https://master.php.net/note/delete/107810/non-english
Del: in docs -- https://master.php.net/note/delete/107810/in+docs
Del: other reasons-- https://master.php.net/note/delete/107810
Reject -- https://master.php.net/note/reject/107810
Search -- https://master.php.net/manage/user-notes.php