PHP Looping Statements


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.  PHP has two major groups of looping statements: for and while. The For statements are best used when you want to perform a loop a specific number of times. The While statements are best used to perform a loop an undetermined number of times. In addition, you can use the Break and Continue statements within looping statements.
  • While Loop
  • Do...While Loop
  • For Loop
  • Foreach Loop
  • Break and Continue Statements

Comments