In Action

Php Toycode - Looping through an array

Simple example demonstrating how to loop through an array using a php foreach loop.


forloop



Toycode

Php Code

Just cut-n-paste to reuse.

     
<?php
$arr=array("one", "two", "three");
$arr[3]= "four";

foreach ($arr as $value)
{
  echo "Value: " . $value . "<br />";
}
?>