note 30308 modified in function.array-shift by vrana
| From: | vrana@php.net | Date: | Tue, 17 Aug 2004 14:49:26 +0000 |
| Subject: | note 30308 modified in function.array-shift by vrana | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-79740@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:
<?php
reset($array);
list($oldKey, $oldElement) = each($array);
unset($array[$oldKey]);
?>
note: the index wil not be changed (not reindexed)
--was--
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://php.net/manual/en/function.array-shift.php