note 89728 rejected from function.array-merge by thiago

From: Date: Fri, 20 Mar 2009 16:29:34 +0000
Subject: note 89728 rejected from function.array-merge by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-152214@lists.php.net to get a copy of this message
Note Submitter: contato at andersonfarga dot net ---- <?php set_time_limit(0); $ini = microtime(true); $array = array('a' => 'ahahaha'); for($x = 0; $x < 10000; $x++) { $array['h' . $x] = $x * $x; } echo 'for variable ' . (microtime(true) - $ini) . '<br />'; $ini2 = microtime(true); $array2 = array('a' => 'ahahaha'); for($x = 0; $x < 10000; $x++) { $array2 = array_merge($array2, array( 'h' . $x => ($x * $x) )); } echo 'array_merge: ' . (microtime(true) - $ini2) . '<br />'; ?> Response: for variable 0.0153610706329 array_merge: 40.4120349884 What? Is real?

« previous php.notes (#152214) next »