1.
$arr1=array('name'=>33,'type'=>1);
$arr2=array('name'=>33,'price'=>200);
$res=array();
foreach($arr1 as $k=>$v){
if(isset($arr2[$k])){
$res
[
$k
] =
$arr1
[
$k
] +
$arr2
[
$k
];
unset($arr1
[
$k
]
,$arr2
[
$k
]
);
}
}
$res=array_merge($res,$arr1,$arr2);
2.
$arr1=array('name'=>33,'type'=>1);
$arr2=array('name'=>33,'price'=>200);
$res=array();
foreach($arr1 as $k=>$v){
if(isset($arr2[$k])){
$res
[
$k
] =
$arr1
[
$k
] +
$arr2
[
$k
];
}
}
$res=$res+$arr1+$arr2;