I have two arrays and I need to compare that and return matched value from array1. Please refer my code below,
$array1 = array("a" => "Green", "Red", "Blue");
$array2 = array("b" => "grEEn", "yellow", "red");
$result = array_intersect(array_map('strtolower', $array1), array_map('strtolower', $array2));
print_r($result);
My result is,
Array
(
[a] => green
[0] => red
)
But my expected result is I want get it from array1 like:
Array
(
[a] => Green
[0] => Red
)