<?php
error_reporting(0);
$mmy = array(array("Chevrolet Truck", "C 1500 SERIES", "2005", "V8 5.7L (K)"),
array("Nissan Pickup", "D21 PICKUP", "1993", "2.4 L"),
array("TOYOTA CAMRY", "LE", "2001", "2.8L V6")
);
var_dump($mmy);
echo "<pre>";
echo "<h1>Data in 2-dimensional array Make/Model/Year/Engine</h1>";
echo "<ul>";
for ($row = 0; $row < 3; $row++) {
echo "<li><b>The row number $row</b>";
echo "<ul>";
for ($make = 0; $make < 4; $make++) {
echo "<li>" . $mmy[$row][$make] . "</li>";
}
for ($model = 1; $model < 4; $model++) {
echo "<li>" . $mmy[$row][$make][$model] . "</li>";
}
for ($year = 2; $year < 4; $year++) {
echo "<li>" . $mmy[$row][$make][$model][$year] . "</li>";
}
for ($eng = 3; $eng < 4; $eng++) {
echo "<li>" . $mmy[$row][$make][$model][$year][$eng] . "</li>";
}
echo "</ul>";
echo "</li>";
}
echo "</ul>";
?>
在不抑制错误报告的情况下,我得到: http ://dpaste.org/iy0rD/#L9
我不清楚偏移错误来自哪里。我不习惯用 PHP 编程。我必须编写一个导入 CSV 文件并显示结果的 PHP 应用程序。这只是整个计划的一部分。现在我已经静态定义了数组以用于测试目的。希望这个问题的格式正确。