For any queries you can reach us at infovistarindia@gmail.com / WhatsApp us: +919158876092

PHP for loop

Overview

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

Syntax:

for (init counter; condtion; increment counter) {
 	code to be executed for each iteration;
}

Example:

for ($num = 0; $num < 10; $num++) {
  	echo "The number is: $num <br>";
}