飞龙博客

妙法莲华经

difference between break continue exit in php

feilong.org 修订于2011-02-08 06:49:44 220 次浏览

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 ';

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

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

所在分类: 网站开发

新作:

旧文: