代码示例:(标识:demo_php_loop_while)
<!DOCTYPE html>
<html>
<body>

<?php 
$x=1;
  
while($x<=5) {
   echo "数字是:$x <br>";
   $x++;
} 
?>   

</body>
</html>
运行结果: