difference between break continue exit in php

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

发表评论

电子邮件地址不会被公开。 必填项已用*标注