Merge two multidimensional arrays and reindex all subarrays
FIXED (again)
function array_merge_to_indexed () { $result = array(); foreach (func_get_args() as $arg) { foreach ($arg as $innerArr) { $result[] = array_values($innerArr); } } return $result;}
Accepts an unlimited number of input arrays, merges all sub arrays into one container as indexed arrays, and returns the result.
EDIT 03/2014: Improved readability and efficiency
more simple and modern way is:
$merged = $array1 + ['apple' => 10, 'orange' => 20] + ['cherry' => 12, 'grape' => 32];
new array syntax from php 5.4