note 30308 added to function.array-shift
| From: | alex at netflex dot nl | Date: | Thu, 13 Mar 2003 16:55:11 +0000 |
| Subject: | note 30308 added to function.array-shift | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45222@lists.php.net to get a copy of this message | ||
Hi,
if you want to shift the first element of a large array (more than 10.000?) and it must realy fast
then you can use this better:
reset($array);
list($oldKey, $oldElement) = each($array);
unset($array[$oldKey]);
note: the index wil not be changed (not reindexed)
--
http://www.php.net/manual/en/function.array-shift.php
http://master.php.net/manage/user-notes.php?action=edit+30308
http://master.php.net/manage/user-notes.php?action=delete+30308
http://master.php.net/manage/user-notes.php?action=reject+30308