Visit the Official PHP Website

Search this Site

PHP Programming

By James N Hitz

Repetition(Iteration) Control Structures

Repetition causes a loop. So Iteration constructs are also called Looping Contructs. In looping, a statement block is repeated over and over and over... so many times it may go on forever causing your computer's processor to spin, get a titanic headache and shut down in protest! Poor thing.

We therefore need to be very careful how we structure our code so that we don't create endless loops. Our iteration construct MUST be able to terminate itself.

Iteration in PHP is achieved using any of the following constructs:

  1. while
  2. do... while
  3. for
  4. foreach

<< The switch Decision Construct | The while Iteration Construct >>

JamHitz Productions