嗨,我似乎无法让它工作,我在第 8 行和第 11 行中不断收到未定义的错误。这是我的代码
<?php
$count = 0;
$temp = 0;
$name = array("Suzuki", "Holden", "Jaguar", "Toyota", "Hyundai", "Ford", "Honda", "Mazda");
echo $name[0] . " " . $name[1] . " " . $name[2] . " " . $name[3] . " " . $name[4] . " " . $name[5] . " " . $name[6] . " " . $name[7] . "<p>";
for ($incount = 0; $incount <= 7; $incount++) {
if ($name[$incount] > $name[$incount + 1]) {
$temp = $name[$incount];
$name[$incount] = $name[$incount + 1];
$name[$incount + 1] = $temp;
echo $name[0] . " " . $name[1] . " " . $name[2] . " " . $name[3] . " " . $name[4] . " " . $name[5] . " " . $name[6] . " " . $name[7] . $count++ . "<p>";
}
}
?>