我需要为给定主题打印以下数组中的学生姓名和标记:
$marks = [
"john" => ["physics" => 30, "maths" => 55, "chemistry" => 66],
"jack" => ["physics" => 44, "maths" => 19, "chemistry" => 87],
"mark" => ["physics" => 77, "maths" => 66, "chemistry" => 67],
];
我理解,如果我echo $marks['john']['chemistry'];
它会打印出学生/科目的标记,但我应该如何接近 foreach 循环来显示所有学生及其化学成绩?