I need to print the student name and the mark from the following array for a given subject:
$marks = [
"john" => ["physics" => 30, "maths" => 55, "chemistry" => 66],
"jack" => ["physics" => 44, "maths" => 19, "chemistry" => 87],
"mark" => ["physics" => 77, "maths" => 66, "chemistry" => 67],
];
I understand that if I do echo $marks['john']['chemistry'];
it will print the mark for the student/subject, but how should I approach a foreach loop for displaying all students and their scores for chemistry?