note 94754 added to function.array-push
| From: | aosojnik at gmail dot com | Date: | Mon, 23 Nov 2009 10:56:56 +0000 |
| Subject: | note 94754 added to function.array-push | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163182@lists.php.net to get a copy of this message | ||
If you want to preserve the keys in the array, use the following:
<?
function array_pshift(&$array) {
$keys = array_keys($array);
$key = array_shift($keys);
$element = $array[$key];
unset($array[$key]);
return $element;
}
?>
----
Server IP: 91.185.195.14
Probable Submitter: 78.153.51.97
----
Manual Page -- http://www.php.net/manual/en/function.array-push.php
Edit -- https://master.php.net/note/edit/94754
Del: integrated -- https://master.php.net/note/delete/94754/integrated
Del: useless -- https://master.php.net/note/delete/94754/useless
Del: bad code -- https://master.php.net/note/delete/94754/bad+code
Del: spam -- https://master.php.net/note/delete/94754/spam
Del: non-english -- https://master.php.net/note/delete/94754/non-english
Del: in docs -- https://master.php.net/note/delete/94754/in+docs
Del: other reasons-- https://master.php.net/note/delete/94754
Reject -- https://master.php.net/note/reject/94754
Search -- https://master.php.net/manage/user-notes.php