PHP While

PHP While

While syntax

while (expression is true) {
execute statement
}

While example

<html>
<body>
<?php
	$x = 1;
	while ($x <= 3) {
		echo "<br />";
		echo "x = ", $x++;
	}
?>
</body>
</html>

Result

x = 1
x = 2
x = 3