說我有:如何在php中組合數組,以便第二個數組覆蓋第一個數組?
$arr1 = array('green', 'yellow', 'blue', 'red');
$arr2 = array('yellow', black, white, 'red');
如果我這樣做array_merge($arr1, $arr2,)
這給:
array(green, yellow, blue, red, yellow, black, white, red);
我希望確保在數組中沒有重複,注意,我沒有使用數組鍵,只值。
有沒有另一個簡單的解決方案,我失蹤了?