4
得到區分大小寫的返回我有兩個數組,我需要比較它並返回array1中的匹配值。請參考我的代碼如下,我怎麼能從array_intersect()
$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
)
但是我預期的結果是我想從像陣列1得到它:
Array
(
[a] => Green
[0] => Red
)
恰到好處..!這就是我要的。謝謝..! – Elavarasan
@Elavarasan不客氣! – Rizier123