Advertisements
Advertisements
Question
What is For each loop in PHP?
Short/Brief Note
Advertisements
Solution
- For each loop is exclusively available in PHP.
- It works only with arrays. The loop iteration deepens on each KEY Value pair in the Array.
- For each, loop iteration the value of the current array element is assigned to $value variable and the array pointer is shifted by one, until it reaches the end of the array element.
shaalaa.com
Looping Structure
Is there an error in this question or solution?
APPEARS IN
RELATED QUESTIONS
What will be displayed in a browser when the following PHP code is executed:
<?php
for (Scounter = 20; $counter< 10;
$counter++)
{
echo “Welcome to Tamilnadu “;
}
echo “Counter is: Scounter”;
?>PHP supports which types of looping techniques ______.
What will be the output of the following PHP code?
<?php
for ($x = -1; $x < 10;--$x)
{
print $x;
}
?>Define for loop in PHP.
Write Syntax of For loop in PHP.
Write Syntax of while loop in PHP.
Compare for loop and for each loop.
Write the purpose of Looping Structure in PHP.
Differentiate While and Do while loops.
Explain the process Do while loop.
