Multidimensional Array
Today we are going to discus multidimensional array. A multidimensional array is an array containing one or more arrays.In this example we have used multidimensional arrays.
Example
<!DOCTYPE html>
<head>
<title>Multidimensional Array</title>
</head>
<head>
<title>Multidimensional Array</title>
</head>
<body>
<?php
$cars= array
(
array("Honda",1000,100),
array("BMW",60,59),
array("Toyota",120,100)
);
echo $cars[0][0].": Ordered: ".$cars[0][1].". Sold: ".$cars[0][2]."<br>";
echo $cars[1][0].": Ordered: ".$cars[1][1].". Sold: ".$cars[1][2]."<br>";
echo $cars[2][0].": Ordered: ".$cars[2][1].". Sold: ".$cars[2][2]."<br>";
<?php
$cars= array
(
array("Honda",1000,100),
array("BMW",60,59),
array("Toyota",120,100)
);
echo $cars[0][0].": Ordered: ".$cars[0][1].". Sold: ".$cars[0][2]."<br>";
echo $cars[1][0].": Ordered: ".$cars[1][1].". Sold: ".$cars[1][2]."<br>";
echo $cars[2][0].": Ordered: ".$cars[2][1].". Sold: ".$cars[2][2]."<br>";
?>
</body>
</html>
</body>
</html>
Output
Honda: Ordered: 1000. Sold: 100
BMW: Ordered: 60. Sold: 59
Toyota: Ordered: 120. Sold: 100
No comments:
Post a Comment