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
Glossary
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.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.