note 102678 deleted from function.array-merge by danbrown

[email protected] Mon, 28 Feb 2011 07:04:57 -0800
Newsgroups php.notes
Message-ID <[email protected]>
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.