note 49817 added to function.array-shift
| From: | php-general at lists dot php dot net | Date: | Wed, 09 Feb 2005 12:27:46 +0000 |
| Subject: | note 49817 added to function.array-shift | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84713@lists.php.net to get a copy of this message | ||
This function will save the key values of an array, and it will work in lower versions of PHP:
<?php
function array_shift2(&$array){
reset($array);
$key = key($array);
$removed = $array[$key];
unset($array[$key]);
return $removed;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.array-shift.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49817
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49817&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49817&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49817&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49817&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49817&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49817&report=yes
Search -- http://master.php.net/manage/user-notes.php