for 循环

| |
[不指定 2006/04/06 08:05 | by admin ]
for (expr1; expr2; expr3) statement



<?php
/* example 1 */

for ($i = 1; $i <= 10; $i++) {
   print $i;
}


/* example 2 */

for ($i = 1; ; $i++) {
   if ($i > 10) {
       break;
   }
   print $i;
}



/* example 3 */

$i = 1;
for (;;) {
   if ($i > 10) {
       break;
   }
   print $i;
   $i++;
}


/* example 4 */

for ($i = 1; $i <= 10; print $i, $i++);
?>


作者:Else 's Blog
地址:http://www.aixq.com/post/28/
版权所有。转载时必须链接形式注明作者和原始出处及本声明!
  • 中查看更多“for 循环”相关内容
  • 中查看更多“for 循环”相关内容
  • 中查看更多“for 循环”相关内容
  • 中查看更多“for 循环”相关内容
  • 中查看更多“for 循环”相关内容
  • 中查看更多“for 循环”相关内容

  • 最后编辑: Else 编辑于2006/05/14 16:22
    代码 程序 编程 | 评论(0) | 引用(0) | 阅读(2020)
    发表评论
    表情
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    打开HTML
    打开UBB
    打开表情
    隐藏
    昵称   密码   游客无需密码
    网址   电邮   [注册]