思路:遍历二维数组,合并两个二维数组的值,赋值给新数组
function mergeArray($arr1,$arr2){ $newArr = []; foreach($arr1 as $v1){ foreach ($arr2 as $v2) { $newArr[] = array_merge($v1,$v2); } } return $newArr; }
思路:遍历二维数组,合并两个二维数组的值,赋值给新数组 function mergeArray($arr1,$arr2){ $newArr = []; foreach($arr1 as $v1){ foreach ($arr2 as $v2) { $newArr[] = array_merge($v1,$v2); } } return $newArr; }
|