Write Syntax of For each loop in PHP.
Advertisements
Question
Write Syntax of For each loop in PHP.
Short/Brief Note
Advertisements
Solution
for each ($array as $value)
{
code to be executed;
}shaalaa.com
Looping Structure
Is there an error in this question or solution?
APPEARS IN
RELATED QUESTIONS
for ($ x=0; $ x<5; x++)
echo “Hai”
The above loop executes how many no of times?
What will be the output of the following PHP code?
<?php
for ($x = 1; $x < 10;++$x)
{
print “*\t”;
}
?>What will be the output of the following PHP code?
<?php
for ($x = -1; $x < 10;--$x)
{
print $x;
}
?>Write Syntax of For loop in PHP.
Write Syntax of while loop in PHP.
Compare for loop and for each loop.
Explain the use of for each loop in PHP.
Write the features Looping Structure.
Differentiate While and Do while loops.
Discuss in detail about Foreach loop.
