> foreach statement in php ~ Online tutorial

foreach statement in php

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.
Syntax
foreach (array as value)
{
code to be executed;
}

Example

<html>
<body>
<?php
$arr=array("one", "two", "three");
foreach ($arr as $value)
{
echo "Value: " . $value . "
";
}
?>
</body>
</html>

Output;

one
two 
three

Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: