PHP For

PHP For

For syntax

for (initialization; condition; incrementation) {
execute statement
}

For example

<html>
<body>
<?php
	for ($n = 1; $n <= 5; $n++) {
		echo "<br />";
		echo "n = ", $n;
	} 
?>
</body>
</html>

Result

n = 1
n = 2
n = 3
n = 4
n = 5