The foreach Statement
The foreach Statement
The foreach statement is used to loop through arrays.
For every loop, the value of the current array element is assigned to $value (and the array pointer is moved by one) – so on the next loop, you’ll be looking at the next element.
foreach (array as value)
{
code to be executed;
}
Example
The following example demonstrates a loop that will print the values of the given array:
<html>
<body>
<?php
$arr=array(”one”, “two”, “three”);
foreach ($arr as $value)
{
echo “Value: ” . $value . “<br />”;
}
?>
</body>
</html>
and output is
Value: one
Value: two
Value: three

November 7th, 2008 at 12:45 am
Do you know of anywhere else that I can get some information about %keyword%? I have come across your post %title% and it has given me some great ideas, but I am looking for some more information about %keyword% any ideas?
November 13th, 2008 at 8:10 am
xtmq3v7mtjgyhryv
June 23rd, 2009 at 5:26 am
nice informitive blog post. I hope to see another post from you on this in the future.
June 25th, 2009 at 7:49 am
this is a great post. I dont know how I stumbled upon it, but it was worth reading. I added this to digg