我创建了一个数组来列出学生所学课程的成绩。但是,我在第 33 行收到 PHP 错误:未定义偏移量。该表似乎以我想要的方式显示,上传到 EasyPHP 后,我似乎只是在浏览器中反复收到此错误。我做错了什么?
<?php
$studentGrades = array(
array(
array("<b>Frank Thomas</b>","<b>Courses Taken</b>", "<b>Course Grade</b>"),
array("Frank Thomas", "Compilers", "<i>D</i>"),
array("Frank Thomas", "Logic and Automated Reasoning", "<i>A</i>"),
array("Frank Thomas", "Advanced Robotics", "<i>A</i>")
),
array(
array("<b>Garry Beebs</b>", "Intro to Computer Vision", "<i>B</i>"),
array("Garry Beebs", "Machine Learning", "<i>B</i>"),
array("Garry Beebs", "Compilers", "<i>A</i>"),
array("Garry Beebs", "Interactive Computer Graphics", "<i>A</i>")
),
array(
array("<b>Jesse Kline</b>", "Distributed Systems", "<i>A</i>"),
array("Jesse Kline", "Intro to Artificial Intelligence", "<i>C</i>"),
array("Jesse Kline", "Advanced Robotics", "<i>B</i>"),
array("Jesse Kline", "Natural Language Processing", "<i>B</i>")
)
);
echo '<table border="2">';
for ( $arrnum = 0; $arrnum < 3; $arrnum++ )
{
for ( $row = 0; $row < 4; $row++ )
{
echo '<tr>';
for ( $col = 0; $col < 4; $col++ )
{
if ($studentGrades[$arrnum][$row][$col] == '')
{
echo "<td> </td>";
}
else
{
if ($row == 0 and $col == 0)
{
echo "<td>". $studentGrades[$arrnum][$row][$col] . "</td>";
}
else if ($row != 0 and $col == 0)
{
echo "<td> </td>";
}
else
{
echo "<td>". $studentGrades[$arrnum][$row][$col] . "</td>";
}
}
}
}
echo "</tr>";
}
echo "</table>";
?>