PHP merge arrays with only NOT DUPLICATED values

前端 未结 5 1957
青春惊慌失措
青春惊慌失措 2020-11-29 06:03

I need to merge two arrays into 1 array but what I need is to remove before the main data they b oth have in common (duplicated values i mean), I need only unique values whe

5条回答
  •  感动是毒
    2020-11-29 07:04

    You can combine the array_merge() function with the array_unique() function (both titles are pretty self-explanatory)

    $array = array_unique (array_merge ($array1, $array2));
    

提交回复
热议问题