-
What will be the output of the following PHP code ?
<?php
$Color1 = array("A" => "Red", "B" => "Green", "C" => "Blue", "D" => "Yellow");
$Color2 = array("E" => "Red","F" => "Green", "H" => "Blue");
$Result = array_intersect($Color1, $Color2);
print_r($Result);
?>
-
- Nothing
-
Array
(
[A] => Red
[B] => Green
[C] => Blue
) -
Array
(
[A] => Red
) - Error
- None of these
Correct Option: B
The array_intersect() function compares the values of two (or more) arrays, and returns the matches.