PHP for


Example

for loops are typically used when you have a piece of code which you want to repeat a given number of times.

for ($i = 1; $i < 10; $i++) {
    echo $i;
}

Outputs: 123456789

For detailed information, see the Loops topic.