In this tutorial you will learn about the PHP For Loop and its application with practical example.
The for loop statement
The for loop is used when we want to execute block of code known times.
1 2 3 4 |
for (initialization; condition; increment) { //Block of code to be executed; } |
Property | Description |
---|---|
initialization | Sets a counter variable |
condition | It test the each loop iteration for a condition. If it returns TRUE, the loop continues. If it returns FALSE, the loop ends. |
increment | Increment counter variable |