我有一个多维数组。要输出所有值,是否有比在下面循环遍历每个级别更简单的方法?
$results['English']['Listening'][] = 100;
$results['English']['Listening'][] = 80;
$results['English']['Exam'][] = 70;
$results['English']['Exam'][] = 90;
$results['Computer']['Exam'][] = 90;
foreach ($results as $subject => $data) {
foreach ($data as $component => $scores) {
foreach ($scores as $score) {
echo "$subject => $component => $score" . "<br/>";
}
}
}