note 51566 deleted from function.array-shift by nlopess

From: Date: Mon, 09 May 2005 12:44:00 +0000
Subject: note 51566 deleted from function.array-shift by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-89154@lists.php.net to get a copy of this message
Note Submitter: cherche1pseudo at gmail dot com ---- Be aware of the size of the array. With an array filled with 1600 lines, unshifting all the elements is much more slower than a foreach() loop !! <?php #unshift loop : 1600 lines while( $line = unshift($array) ) { //nothing to do ! } #total time : 77,3621029854 seconds ?> <?php #foreach loop : 1600 lines, the same array as above foreach( $array as $key => $line ) { unset($array[$key]); } #total time : 0,920037031174 seconds ?>

« previous php.notes (#89154) next »