For Loop

Loops execute a block of code a specified number of times, or while a specified condition is true.

Syntax

for (initialize; condition; increment)
{
block of codes
}

Example

<?php
for($i=1;$i<=10;$i++){
echo $i.” t”;
}
?>

Output

1 2 3 4 5 6 7 8 9 10

Share