Multidimensional Array in PHP
<?php
//creating 2dimensional array
$favCol = array(
array("red","green","blue"),
array("red2","green2","blue2"),
array("red3","green3","blue3")
);
//echo $favCol[1][1];
//printing the content of 2 dimensional array
/*for($i=0; $i<count($favCol); $i++) {
echo var_dump($favCol[$i]);
echo "<br>";
}*/
for($i=0; $i<count($favCol); $i++) {
for($j=0; $j<count($favCol[$i]); $j++) {
echo $favCol[$i][$j];
echo " ";
}
echo "<br>";
}
?>
Comments
Post a Comment