note 102678 deleted from function.array-merge by danbrown
| From: | danbrown@php.net | Date: | Mon, 28 Feb 2011 15:04:57 +0000 |
| Subject: | note 102678 deleted from function.array-merge by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177407@lists.php.net to get a copy of this message | ||
Note Submitter: Timothy Armstrong
----
To respond to Bob's post, there is a much simpler way to merge a dynamic number of arrays
together:
<?php
// assuming $someArrays is an array of the arrays we want to merge
$mergedArray = call_user_func_array('array_merge', $someArrays);
?>
This is a lot simpler than using the for-loop. Using call_user_func_array is a simple way to call
any function whenever you don't know the number of parameters.