How can i do an array_merge on an associative array, like so:
Array 1:
$options = array (
\"1567\" => \"test\",
\"1853\" => \"test1\",
);
This code could be used for recursive merge:
function merge($arr1, $arr2){
$out = array();
foreach($arr1 as $key => $val1){
if(isset($arr2[$key])){
if(is_array($arr1[$key]) && is_array($arr2[$key])){
$out[$key]= merge($arr1[$key], $arr2[$key]);
}else{
$out[$key]= array($arr1[$key], $arr2[$key]);
}
unset($arr2[$key]);
}else{
$out[$key] = $arr1[$key];
}
}
return $out + $arr2;
}