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.
Try following code it works fine for numbers,String and every condition
The following Logic will only works for numbers.
$array1 = array(10, 15, 20, 25);
$array2 = array(10, 15, 100, 150);
$output = array_merge(array_diff($array1, $array2), array_diff($array2, $array1));
The following logic will work fine for any condition
$a1 = array('1@gmail.com');
$a2 = array('1@gmail.com','2@gmail.com');
$new_array=array_merge($a1,$a2);
$unique=array_unique($new_array);
Thanks