note 89728 added to function.array-merge
| From: | contato at andersonfarga dot net | Date: | Fri, 20 Mar 2009 16:25:20 +0000 |
| Subject: | note 89728 added to function.array-merge | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152213@lists.php.net to get a copy of this message | ||
<?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?
----
Server IP: 200.185.126.110
Probable Submitter: 189.7.130.106
----
Manual Page -- http://www.php.net/manual/en/function.array-merge.php
Edit -- https://master.php.net/note/edit/89728
Del: integrated -- https://master.php.net/note/delete/89728/integrated
Del: useless -- https://master.php.net/note/delete/89728/useless
Del: bad code -- https://master.php.net/note/delete/89728/bad+code
Del: spam -- https://master.php.net/note/delete/89728/spam
Del: non-english -- https://master.php.net/note/delete/89728/non-english
Del: in docs -- https://master.php.net/note/delete/89728/in+docs
Del: other reasons-- https://master.php.net/note/delete/89728
Reject -- https://master.php.net/note/reject/89728
Search -- https://master.php.net/manage/user-notes.php