note 23132 deleted from function.array-unshift by danbrown

From: Date: Wed, 12 Aug 2009 16:41:10 +0000
Subject: note 23132 deleted from function.array-unshift by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-159383@lists.php.net to get a copy of this message
Note Submitter: jrh_at_geodata.soton.ac.uk ---- 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.

« previous php.notes (#159383) next »