Continue is used to stop script on specific condition and then continue looping statement until reach the end..
Break is used to exist the loop totaly once specific condition match
Bottom of line:
continue iterate loop and skip rest of part on specific condition and start from begining of loop until reach the end, whereas break throw out of loop on specific condition.
Example
0 1 2 3 4 continue condition is matched, skip rest of part. 6 7 8 9
------------------------------------------------------------------------------
0 1 2 3 4 break condition is matched, stop execution here.
Break is used to exist the loop totaly once specific condition match
Bottom of line:
continue iterate loop and skip rest of part on specific condition and start from begining of loop until reach the end, whereas break throw out of loop on specific condition.
Example
for($i=0; $i<10; $i++){
if($i == 5){
echo "continue condition is matched, skip rest of part.<br>";
continue;
}
echo $i . "<br>";
}
echo "<hr>";
for($i=0; $i<10; $i++){
if($i == 5){
echo "break condition is matched, stop execution here.<br>";
break;
}
echo $i . "<br>";
}
Output:0 1 2 3 4 continue condition is matched, skip rest of part. 6 7 8 9
------------------------------------------------------------------------------
0 1 2 3 4 break condition is matched, stop execution here.