Loop through an indexed array


SUBMITTED BY: henry1874w

DATE: June 17, 2017, 1:07 p.m.

FORMAT: Text only

SIZE: 216 Bytes

HITS: 229

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4. <?php
  5. $cars = array("Volvo", "BMW", "Toyota");
  6. $arrlength = count($cars);
  7. for($x = 0; $x < $arrlength; $x++) {
  8. echo $cars[$x];
  9. echo "<br>";
  10. }
  11. ?>
  12. </body>
  13. </html>

comments powered by Disqus