for
Loops a specific number of times.
Syntax
for ($i = 0; $i < n; $i++) { }Description
Counter-based loop with three parts: start, condition, increment.
Example
Loading editor…
Expected output
1 2 3
When to use?
Specific repetition, indexed operation.