$array1 = array("a","b");
$array2 = array("b","c");
I want the following array from above arrays containing items which are not common in both arrays.
$output = array("a","c");
I have tried folloing
$output = array_diff($array1,$array2);
How can do it. Thanks.
Just make subtraction of union and intersection:

$array1 = array("a","b");
$array2 = array("b","c");
$output = array_diff(array_merge($array1, $array2), array_intersect($array1, $array2));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With