我有两个这样的数组:
array(
'11' => '11',
'22' => '22',
'33' => '33',
'44' => '44'
);
array(
'44' => '44',
'55' => '55',
'66' => '66',
'77' => '77'
);
我想结合这两个数组,使其不包含重复项,并保留其原始键。例如,输出应为:
array(
'11' => '11',
'22' => '22',
'33' => '33',
'44' => '44',
'55' => '55',
'66' => '66',
'77' => '77'
);
我已经尝试过了,但是它正在更改其原始键:
$output = array_unique( array_merge( $array1 , $array2 ) );
有什么办法吗?