0
我創建了一個數組來列出他們所學課程的學生成績。但是,我收到第33行的PHP錯誤:未定義的偏移量。該表似乎以我想要的方式顯示,我似乎在上載到EasyPHP後在瀏覽器中反覆出現此錯誤。我做錯了什麼?PHP錯誤:未定義偏移量
<?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>";
?>