In Action

Php Toycode - Looping through a list (array)

Simple example demonstrating how to loop through a list using a php foreach loop. In Php the terms array and list mean the same thing. This example uses the ++ iterator.



Php Code

Just cut-n-paste to reuse.

$fxarr = array("f", "u", "b", "a", "r");

foreach($fxarr as $itm) 
	echo $pos++ . " " . $itm . "\n";