The for loop is used when you know in advance how many times the script should run.and for loop is entry control loop like a while loop the following parameters of for loop.
Initialization - used to set a counter.
Condition - Evaluated for each loop iteration.if evaluates to true,the loop continues.if it evaluates to false,the loop end.
Increment & Decrement - used to increment and decrement counter.
<?php
for(initialization; condition; increment/decrement)
{
code to be executed
}
?>
<?php
for($i=1; $i<=10; $i++)
{
echo $i."
";
}
?>
1
2
3
4
.
.
10