Blogger Information
Blog 87
fans 0
comment 0
visits 59280
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
第五章:1 while循环
黄忠倚的博客
Original
593 people have browsed it

实例

<?php
/**
 * while 循环
 * 1.入口判断:while(condition){#code}
 * 2.出口判断;do {#code}while{condition}
 */
// echo '<h3>while循环</h3><hr color="green">';
// for ($i=0; $i<10; $i++) {
// 	echo $i<9 ? $i.',' : $i;
// }
// echo '<hr>';

//用while循环来实现同样的功能
//入口判断:while()
// $i = 0;  //初始条件
// while ($i<10) {
// 	echo $i<9 ?$i.',' :$i;
// 	$i++; //更新条件
// }

echo '<hr>';
//出门判断:do ~ while
// $i = 0;	 //初始条件
$i = 10;  //初始条件
do {
	echo $i<9 ? $i.',' : $i;
	$i++;  //更新条件
} while ($i<10);  //循环条件

运行实例 »

点击 "运行实例" 按钮查看在线实例


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post