There are two arrays that say below the data -
$ a = Array (a, b, d, c, e, a); $ b = Array (a, a, d, e, c, a);
I want to delete an instance of array values as a pair, i.e. it must exist in the array 'a' and array 'b' If you understand, I want to remove the elements that form a similar pair.
The result should finally be -
$a = [b]; $b = [a];
because these are the only remaining elements that do not create a pair.
I tried using array_diff but did not get the expected result -
$arr1 = array_diff($aArr, $bArr);
$arr2 = array_diff($bArr, $aArr);
print_r($arr1);
print "<br>";
print_r($arr2);
$res = count($arr1) + count($arr2);
print $res;
This code works fine when the input signal is Array (c, d, e)
Array (a, b, c)
(a, a, b, d, e, c, a)
(b, a, b, d, e, c, a)
?
.