note 105651 added to function.array-merge
| From: | heitor dot siller at gmail dot com | Date: | Sun, 04 Sep 2011 07:11:29 +0000 |
| Subject: | note 105651 added to function.array-merge | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182935@lists.php.net to get a copy of this message | ||
The function posted by
jpakin at gmail dot com 11-Jun-2010 03:46
Is extremely FAST! It was tooking me about 200 seconds to merge 25,000 arrays using the ordinary
array_merge function, but the proposed one took not more than 5 seconds. Fantastic contribution!
Here's it again:
<?php
function mergeArrays(&$sourceArray, &$copyArray){
//merge copy array into source array
$i = 0;
while (isset($copyArray[$i])){
$sourceArray[] = $copyArray[$i];
unset($copyArray[$i]);
$i++;
}
}
?>
----
Server IP: 187.73.33.5
Probable Submitter: 186.204.71.66
----
Manual Page -- http://www.php.net/manual/en/function.array-merge.php
Edit -- https://master.php.net/note/edit/105651
Del: integrated -- https://master.php.net/note/delete/105651/integrated
Del: useless -- https://master.php.net/note/delete/105651/useless
Del: bad code -- https://master.php.net/note/delete/105651/bad+code
Del: spam -- https://master.php.net/note/delete/105651/spam
Del: non-english -- https://master.php.net/note/delete/105651/non-english
Del: in docs -- https://master.php.net/note/delete/105651/in+docs
Del: other reasons-- https://master.php.net/note/delete/105651
Reject -- https://master.php.net/note/reject/105651
Search -- https://master.php.net/manage/user-notes.php