Upon trying this code, I am confused why the value yellow is not displayed.
Can someone elaborate this, please ?
$array1 = array("a" => "green", "red", "blue", "red");
$array2 = array("b" => "green", "yellow", "red");
$result = array_diff($array1, $array2);
print_r($result);
Multiple occurrences in $array1 are all treated the same way. This will output :
Array
(
[1] => blue
)