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


Smartphone icons created by Freepik - Flaticon

Indexed Arrays

Loop Through an Indexed Array

Volvo
BMW
Toyota

<?php
// define $cars array
$cars = array("Volvo", "BMW", "Toyota");

// count the length of the array
$arrlength = count($cars);

for($x = 0; $x < $arrlength; $x++) {

// loop through and display the value of each object in the array
  echo $cars[$x];
  echo "<br>";
}
?>