This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

PHP Arrays

Two-dimensional Arrays

Volvo: Ordered: 100. Sold: 96
BMW: Ordered: 60. Sold: 59
Toyota: Ordered: 110. Sold: 100

<?php
// A two-dimensional array
$cars=array
  (
  array("Volvo",100,96),
  array("BMW",60,59),
  array("Toyota",110,100)
  );

// loop through the arrays and display their properties  
echo $cars[0][0].": Ordered: ".$cars[0][1].". Sold: ".$cars[0][2]."
"; echo $cars[1][0].": Ordered: ".$cars[1][1].". Sold: ".$cars[1][2]."
"; echo $cars[2][0].": Ordered: ".$cars[2][1].". Sold: ".$cars[2][2]."
"; ?>