Hopefully you won’t crash into a car, but here in this tutorial you will learn about the foreach loop that we can use with my favorite variable: the array. This is very useful when objects in the array may not be in order, or they are not all identified by numbers(in some cases, there are no numbers).
Here are the sources used in this tutorial:
tut011.php
<?php //PHP Tutorial 011 //while /*for($x = 0; $x < 4; $x+=1){ echo "taco 123-$x<br />"; }*/ $array = array(); $array[] = array("socks",12); $array[] = array("toilet paper",20); $array[] = array("pudding", 0.02); $array[] = array("forks", 30); foreach($array as $itemy){ echo $itemy[0]." is $".$itemy[1]."<br />"; } //echo "bricks."; /*$x = 0; while($x < 4){ echo "taco 123<br />"; $x+=1; }*/ ?>