数组如下所示:
Array
(
[0] => Array
(
[memberid] => 5203
)
[1] => Array
(
[memberid] => 494
)
[2] => Array
(
[memberid] => 1053
)
[3] => Array
(
[memberid] => 1081
)
)
如何使用内部数组找出外部数组索引(例如0,1,2)。
答案 0 :(得分:0)
您可以迭代外部数组,并在当前内部数组值匹配时保存密钥:
$outerKey = null;
foreach($outerArray as $key => $member){
if($member['memberid'] == 1081){
$outerKey = $key;
break;
}
}
echo $outerKey; // it will print 3