PHP For Loops

The for loop is simply a while loop with a bit more code added to it. The common tasks that are covered by a for loop are:
  • Set a counter variable to some initial value.
  • Check to see if the conditional statement is true.
  • Execute the code within the loop.
  • Increment a counter at the end of each iteration through the loop.
   for (init; condition; increment)
    code to be executed;
  • init: Mostly used to set a counter (but can be any code to be executed once at the beginning of the loop)
  • condition: Evaluated for each loop iteration. If it evaluates to TRUE, the loop continues. If it evaluates to FALSE, the loop ends.
  • increment: Mostly used to increment a counter (but can be any code to be executed at the end of the loop)
PHP Arrays
PHP If...Else Statements
PHP Forms and User Input
PHP Functions