note 23132 added to function.array-unshift
| From: | jrh_at_geodata.soton.ac.uk@php.net | Date: | Wed, 10 Jul 2002 13:30:49 +0000 |
| Subject: | note 23132 added to function.array-unshift | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-32835@lists.php.net to get a copy of this message | ||
I have found array_unshift is a function that should be avoided when unshifting lots of data in
large arrays.
In a recent script I wrote, it took approx. 24 seconds to unshift 3500 timestamps to an array, a
work around could be to use array_reverse and array_push. Array_push is much faster due to the
indexing.
--
http://www.php.net/manual/en/function.array-unshift.php
http://master.php.net/manage/user-notes.php?action=edit+23132
http://master.php.net/manage/user-notes.php?action=delete+23132
http://master.php.net/manage/user-notes.php?action=reject+23132