The for loop statement
The for statement is used when you know how many times you want to execute a statement or a block of statements.
for (initialization; condition; increment) {
code to be executed;
}
<?php
for ($i = 0; $i <= 20; $i++) {
echo "The number is: $i <br>";
}
?>
Output :
The number is 1
The number is 2
.
.
The number id 20
© 2024 Easy To Learning. All Rights Reserved | Design by Easy To Learning