$arr = array($arr1,$arr2,..);
如何搜索$arr
以查找key1 => 'something'
,key2 => 'something else'
答案 0 :(得分:4)
您可以使用Iterators迭代嵌套数组,例如
$iterator = new RecursiveIteratorIterator(
new RecursiveArrayIterator($nestedArray),
RecursiveIteratorIterator::SELF_FIRST);
foreach($iterator as $key => val) {
if($key === 'something') {
echo $val;
}
}
或者,请查看array_walk_recursive