PHP的for循环

For循环执行代码块指定的次数,或者当指定的条件为真时循环执行代码块.for循环用于您预先知道脚本需要运行的次数的情况

for(初始值;条件;增量)

要执行的代码;

<html>
<body>
<?php
for ($i=1; $i<=5; $i++)

 {

  echo "The number is " . $i . "<br>";

 }
?>
</body>
</html>
输出:

The number is 1
The number is 2
The number is 3
The number is 4
The number is 5

 

posted @ 2020-03-11 09:38  blog_zss小帅-博客猿  阅读(187)  评论(0编辑  收藏  举报