PHP合并数组的方式有以下几种:
$array1 = [1, 2, 3];
$array2 = [4, 5, 6];
$mergedArray = array_merge($array1, $array2);
$array1 = [1, 2, 3];
$array2 = [4, 5, 6];
$mergedArray = $array1 + $array2;
$array1 = ['fruit' => 'apple', 'color' => 'red'];
$array2 = ['fruit' => 'banana', 'shape' => 'curved'];
$mergedArray = array_merge_recursive($array1, $array2);
$array1 = [1, 2, 3];
$array2 = [3, 4, 5];
$mergedArray = array_unique($array1 + $array2);
$array1 = ['fruit' => 'apple', 'color' => 'red'];
$array2 = ['fruit' => 'banana', 'shape' => 'curved'];
$mergedArray = array_replace($array1, $array2);