Tutorialsplane

PHP For Loop


PHP For Loop:– For Loop is also used for iteration which allows code to be executed repeatedly till the condition being true.


PHP For Loop | Example

Let us take an example to understand For loop.

Syntax

for(init value; test value; increment value){
//code for execution
}

Example

<?php
for($x=1;$x<5;$x++){
	echo $x;
	echo "<br>";
}
?>

PHP Tutorial