📜  php 在数组中查找键 - PHP 代码示例

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

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

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