difference between two arrays

To get the difference between the two arrays you need to do the following:

$fullDiff = array_merge(array_diff($array1, $array2), array_diff($array2, $array1));

The reason being that array_diff() will only give you the values that are in $array1 but not $array2, not the other way around. The above will give you both.

Leave a Comment