44. PHP while
来源:互联网 发布:手机怎样在淘宝买东西 编辑:程序博客网 时间:2024/06/06 00:15
while
(PHP 4, PHP 5)
while 循环是 PHP 中最简单的循环类型。它和 C 语言中的 while 表现地一样。while 语句的基本格式是:
while (expr) statement
while 语句的含意很简单,它告诉 PHP 只要 while 表达式的值为 TRUE 就重复执行嵌套中的循环语句。表达式的值在每次开始循环时检查,所以即使这个值在循环语句中改变了,语句也不会停止执行,直到本次循环结束。有时候如果 while 表达式的值一开始就是 FALSE,则循环语句一次都不会执行。
和 if 语句一样,可以在 while 循环中用花括号括起一个语句组,或者用替代语法:
while (expr): statement ...endwhile;
下面两个例子完全一样,都显示数字 1 到 10:
<?php/* example 1 */$i = 1;while ($i <= 10) { echo $i++; /* the printed value would be $i before the increment (post-increment) */}/* example 2 */$i = 1;while ($i <= 10): print $i; $i++;endwhile;?>
0 0
- 44. PHP while
- php while
- PHP中的while循环
- PHP do while 详解
- php do while
- 45. PHP do-while
- 015.php循环while
- php do while
- php while循环
- PHP While 循环
- php while 与do while的区别
- PHP中的do...while循环
- php foreach、while性能比较
- php学习-10while循环
- PHP做While循环教程
- php--while与for循环
- php中while和do—while循环语句
- PHP流程控制语句-while、do..while循环语句
- 数组 Remove Duplicates from Sorted Array
- soapui+groovy进行接口自动化测试浅谈
- 蓝桥杯:第三十九级台阶
- Spring BlazeDS Integration Reference Guide
- LeetCode Sort Colors
- 44. PHP while
- 张伟平得罪巩俐:在张艺谋面前捏造其劈腿
- 蝶恋花
- 欢迎使用CSDN-markdown编辑器
- UPC:2218 Thrall’s Dream(BFS)
- ZooKeeper基础
- Video Google: A Text Retrieval Approach to Object Matching in Videos
- XSLT输出比较或运算不想被转义
- [OSGI]OSGI入门介绍