标签: php arrays function output information-retrieval
我有以下数组:
$var = array( key1 => array(value1, value2, value3), key2 => array(value4, value5, value6, value7) );
如何获取包含value5?
value5
答案 0 :(得分:5)
使用简单的foreach
foreach
foreach($var as $k=>$arr) { if(in_array('value5',$arr)) { echo $k; break; } }
Demo