PHP For Loop

PHP for loop can be used through a set of codes for the specified number of times.

Syntax

<?php
for(initialization; condition; increment/decrement){  
//code to be executed  
}  
?>

Example

The example below return the numbers from 0 to 5:

<?php
for ($a = 0; $a <= 5; $a++) {
    echo "The number is: $a 
"; } ?>

On: 01-16-2020