我有一个数组,我想找到所有值correct => true
:
$quiz_array = array (
'question1' => array (
'q1a1' => array (
'correct' => FALSE,
'answer' => 'false answer1'
),
'q1a2' => array (
'correct' => FALSE,
'answer' => 'false answer2'
),
'q1a3' => array (
'correct' => FALSE,
'answer' => 'false answer3'
),
'q1a4' => array (
'correct' => TRUE,
'answer' => 'correct answer'
)
)
);
我想做一个搜索,q1a4
在这种情况下它会返回,因为correct => TRUE
. 我尝试使用in_array
但array_search
没有运气。有什么建议么?