📜  根据值 php 代码示例获取数组键

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

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

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