您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息

php while语句的用法

2024/4/19 8:02:12发布5次查看
在php中while语句指的是while循环语句,用于重复执行代码块,直到指定的条件不成立,其语法是【while (条件){要执行的代码;}】。
推荐:《php视频教程》
php while 循环
while 循环将重复执行代码块,直到指定的条件不成立。
语法
while (条件){ 要执行的代码;}
实例
下面的实例首先设置变量 i 的值为 1 ($i=1;)。
然后,只要 i 小于或者等于 5,while 循环将继续运行。循环每运行一次,i 就会递增 1:
<html><body><?php$i=1;while($i<=5){ echo "the number is " . $i . "<br>"; $i++;}?></body></html>
输出:
the number is 1the number is 2the number is 3the number is 4the number is 5
以上就是php while语句的用法的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录