Warning! $array1 + $array2 overwrites keys, so my solution (for multidimensional arrays) is to use array_unique()
array_unique(array_merge($a, $b), SORT_REGULAR);
Notice:
5.2.10+ Changed the default value of
sort_flags
back to SORT_STRING.5.2.9 Default is SORT_REGULAR.
5.2.8- Default is SORT_STRING
It perfectly works. Hope it helps same.