我在下面有一个关联数组:
$questions = array();
while ($selectedstudentanswerstmt->fetch()) {
$questions[$detailsStudentId][$detailsQuestionId] = array(
'questionno'=>$detailsQuestionNo,
'content'=>$detailsQuestionContent
);
}
现在我想在 for each 循环中显示这里的信息,但我的问题是应该调用 foreach 循环,因为我相信下面是不正确的,因为它一直在说questionno
并且content
在循环中未定义:
var_dump($questions);
foreach ($questions as $questionId => $question) {
//LINE 571
echo '<p><strong>Question:</strong> ' .htmlspecialchars($question['questionno']). ': ' .htmlspecialchars($question['content']) . '</p>' . PHP_EOL;
}
Notice: Undefined index: questionno in ... on line 571
Notice: Undefined index: content in ... on line 571