For Loop in PHP For Beginner
The for loop - Loops through a block of code a specified number of times.
The for loop is used when you know in advance how many times the script should run.
// using for loop in PHP
// Write number 0 to 10;
for ($counter = 0; $counter <= 10; $counter++) {
echo $counter . "<br>";
}
echo "<br>";
// Reverse For loop for 10 to 0
for ($counter = 10; $counter >= 0; $counter--) {
echo $counter . "<br>";
}

0 comments
Post a Comment