In PHP, for loops execute a block of program a specified number of times, or while a specified condition is true.
Syntax :
for (initial; condition; increment)
{
Program will execute if condition is true;
}
<?php
$i = 1;
for($i=0;$i<=4;$i++) {
echo $i;
}
?>
Output : 1 2 3 4 .