📜  通过值数组获取键 php 代码示例

📅  最后修改于: 2022-03-11 14:54:44.094000             🧑  作者: Mango

代码示例2
$array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');

$key = array_search('green', $array); // $key = 2;
$key = array_search('red', $array);   // $key = 1;