我有两个数组,我需要比较它并从 array1 返回匹配的值。请参考我下面的代码,
$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);
我的结果是,
Array
(
[a] => green
[0] => red
)
但我的预期结果是我想从 array1 中得到它,比如:
Array
(
[a] => Green
[0] => Red
)