$car = array(
array("Honda","2018","230000"),
array("nissan","2019","2700000"),
array("Honda","2020","3000000")
);
$row=0;
$col=0;
while ($row < 3) {
echo "this is the row $row <br>";
$row ++;
while ($col <3) {
echo "<ul>";
echo "<li>";
echo $car[$row][$col]."<br>";
echo "</li>";
echo "</ul>";
$col++;
}
}
the loop only access the first row and neglecting other rows
the loop only access the first row and neglecting other rows
>Solution :
$car = array(
array("Honda","2018","230000"),
array("nissan","2019","2700000"),
array("Honda","2020","3000000")
);
$row=0;
$col=0;
while ($row < 3) {
echo "this is the row $row <br>";
while ($col <3) {
echo "<ul>";
echo "<li>";
echo $car[$row][$col]."<br>";
echo "</li>";
echo "</ul>";
$col++;
}
$row ++;
$col=0;
}