I have 2 arrays that I\'m trying to get the unique values only from them. So I\'m not just trying to remove duplicates, I\'m actually trying to remove both duplicates.
Another good solution is this:
$array1 = array(10, 15, 20, 25); $array2 = array(10, 15, 100, 150); $output = array_diff(array_merge($array1, $array2), array_intersect($array1, $array2)); // $output will be (20, 25, 100, 150);
$array1 = array(10, 15, 20, 25);
$array2 = array(10, 15, 100, 150);
$output = array_diff(array_merge($array1, $array2), array_intersect($array1, $array2));
// $output will be (20, 25, 100, 150);