Advertisements
Advertisements
Question
Explain the use of for each loop in PHP.
Short/Brief Note
Advertisements
Solution
- The foreach loop works only on arrays,
- It is used to loop through each key/value pair in an array.
shaalaa.com
Looping Structure
Is there an error in this question or solution?
APPEARS IN
RELATED QUESTIONS
The loop exclusively used for arrays is _____.
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 “*\t”;
}
?>What will be the output of the following PHP code?
<?php
for ($x = -1; $x < 10;--$x)
{
print $x;
}
?>List out Looping Structure in PHP.
Write Syntax of For each loop in PHP.
Compare for loop and for each loop.
Write the features Looping Structure.
Discuss in detail about Foreach loop.
Explain the process Do while loop.
