Forum Moderators: coopster
$array1 + $array2 doesn't seem to like multi-dimensional arrays. array_merge didn't seem to be the answer either because there could be numeric keys involved. I thought about writing a recursive function to loop through all the values, but i couldn't figure out how to find the appropriate place in the other array to put the new value.
it seems like there is a fairly good lack of built in recursive functions for arrays.
any ideas?
$arr2[test][1] = '1-overwritten' ;
$arr2[test][2][a] = '2a-overwritten' ;
$arr2[test][2][d][ii] = '2dii-overwritten' ;
and i want it to result in:
$arr3[key][test][1] = '1-overwritten' ;
$arr3[key][test][2][a] = '2a-overwritten' ;
$arr3[key][test][2][b] = '2b' ;
$arr3[key][test][2][c] = '2c' ;
$arr3[key][test][2][d][i] = '2di' ;
$arr3[key][test][2][d][ii] = '2dii-overwritten' ;
$arr3[key][test][3] = '3' ;
$arr3[key][test][4] = '4' ;