$main_array= array(
"Key1" => array(1,2,14,15,16,17,18,19,22,45,47),
"Key2" => array(6,7,40,41,42,43,48,51,52),
"Key3" => array(4,5,8,46,49,53),
"Key4" => array(3,12,13,50),
"Key5" => array(0,9,10,11,20,23,44,),
"Key6" => array(21,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,55,56,57),
"Key7" => array(53)
);
你能指出我如何获得KeyX值?
所需命令$ getKey(53) - 53位于Key7
中答案 0 :(得分:1)
尝试这样的事情:
foreach ($main_array as $key => $value) {
if(is_array($value) && array_search($search, $value) !== false) {
return $key;
}
}