2 yrs ·Translate

PHP for Loop:
The for loop - Loops through a block of code a specified number of times.

The PHP for Loop
The for loop is used when you know in advance how many times the script should run.

Parameters:
init counter: Initialize the loop counter value
test counter: Evaluated for each loop iteration. If it evaluates to TRUE, the loop continues. If it evaluates to FALSE, the loop ends.
increment counter: Increases the loop counter value
Examples
The example in image; displays the numbers from 0 to 10:

Example Explained
$x = 0; - Initialize the loop counter ($x), and set the start value to 0
$x <= 10; - Continue the loop as long as $x is less than or equal to 10
$x++ - Increase the loop counter value by 1 for each iteration

#scappy #content #php

image