I have following two arrays. I want the difference between these two arrays. That is, how can I find the values that do not exist in both arrays?
$array1 = [64, 98, 112, 92, 92, 92];
$array2 = [3, 26, 38, 40, 44, 46, 48, 52, 64, 68, 70, 72, 102, 104, 106, 92, 94, 96, 98, 100, 108, 110, 112];
Note: this answer will return the values in $array2
that are not present in $array1
, it will not return the values in $array1
that are not in $array2
.
$diff = array_diff($array2, $array1);