飞龙博客

深入经藏 智慧如海

difference between break continue exit in php

feilong.org 修订于2011-06-10 11:50:48 708

What the difference between break continue or exit in php?Here feilong give some tips and a sample.

1.continue:skip the present, to the next.
2.break:out of the loop,
3.exit out of the php

Sample,

$i = 1;while (true) {
if ($i==2) {
$i++;continue;// skip 2 and go to the next
} elseif ($i==5) {
break;// go out of the loop
} else {
echo $i . "\n>";
}
$i++;
}
exit;
echo 'continue skip present.break go out of the loop,exit ';

更新网址:http://feilong.org/difference-between-break-continue-exit-php
最初发布:20110208 06:49:44 feilong.org 于广州

加入收藏夹,查看更方便。

所在分类: 网站开发

新作:

旧文:

飞龙前端QQ群