difference between break continue exit in php (444)
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,
|
1 2 3 4 5 6 7 8 9 10 11 12 |
$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
2011-02-08 ~ 2011-02-08
加入收藏夹,查看更方便。
分类: 网站开发