PHP Looping Structure
Points to Remember
● PHP while loops execute a block of code while the specified condition is true.
● The for loop is used when you know in advance how many times the script should run.
● The foreach loop works only on arrays, and is used to loop through each key/value pair in an array.
● do...while - loops through a block of code once, and then repeats the loop as long as the specified condition is true
Looping Structure : In programming it is often necessary to repeat the same block of code a given number of times, or until a certain condition is met. This can be accomplished using looping statements
for Loop : For loops execute a block of code a specified number of times.
foreach Loop : The foreach construct provides an easy way to iterate over arrays
While Loop : PHP while loops execute a block of code while the specified condition is true.