Using foreach() to Iterate Through an Array
<?php
$myarray = array('php', 'is', 'cool');
foreach($myarray as $key => $val) {
echo "The value of index $key is: $val<BR>";
}
foreach($myarray as $val) {
echo "Value: $val<BR>";
}
?>
Related examples in the same category