I am trying to use array_combine to combine two multi-dimensional arrays, but somehow not doing it correctly.
Here is array1:
Array(
[Nov 18, 2
The result you're looking for looks really custom to me. That is to say, I don't know of any built-in PHP array functions that would do that. However, I did write a custom function for you. Warning: it is very tailored to this occasion and thus probably not very reusable.
function cust_array_merge(array $array1, array $array2)
{
$merged = array();
// loop through main array
foreach ($array1 as $key => $val) {
// check if $array2 has the same index
if (array_key_exists($key, $array2)) {
// reset $array1's indexes to $array2's values
foreach ($array2[$key] as $subKey => $subVal) {
if (array_key_exists($subKey, $array1[$key])) {
$tempVal = $array1[$key][$subKey];
unset($array1[$key][$subKey]);
$array1[$key][$subVal] = $tempVal;
}
}
$merged = $array1;
}
}
return $merged;
}