for loop through a block of code until a certain condition is met.
Below the syntax of for loop
- for (initialization; condition; increment/decrement){
- //code to be executed
- }
for ($i = 1; $i <= 5; $i++)
echo "$i<br/>";
for loop through a block of code until a certain condition is met.
Below the syntax of for loop
for ($i = 1; $i <= 5; $i++)
echo "$i<br/>";
Output:
1 2 3 4 5