Advertisements
Advertisements
प्रश्न
Discuss in detail about Foreach loop.
थोडक्यात उत्तर
Advertisements
उत्तर
- The foreach statement is used to loop through arrays.
- For each pass the value of the current array element is assigned to $value and the array pointer is moved by one and in the next pass next element will be processed.

Foreach loop Structure and Flow - Syntax:
foreach ($array as $value) { code to be executed; } -
Example:
<?php $Student_name = a rrayÇ’MagiIan’ “Iniyan’ “NiIani’ “Sibi’ “Shini”); foreach ($Student_name as $value) { echo “$value <br>”; } ?>
shaalaa.com
Looping Structure
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
APPEARS IN
संबंधित प्रश्न
for ($ x=0; $ x<5; x++)
echo “Hai”
The above loop executes how many no of times?
What will be displayed in a browser when the following PHP code is executed;
<?php
for ($counter = 10; $counter < 10;
$counter = $counter + 5){
echo “Hello”;
}
?>PHP supports which types of looping techniques ______.
Write Syntax of For loop in PHP.
Write Syntax of Do while loop in PHP.
Explain the use of for each loop in PHP.
Write the purpose of Looping Structure in PHP.
Write short notes on Do while Loop.
Explain the process Do while loop.
Explain working of loops in array.
