PHP break Statement

PHP break ends execution of the current for, foreach, while, do-while or switch structure.

break accepts an optional numeric argument. The default value is 1

Example - break 1

$arr = array('A', 'B', 'C', 'D', 'E', 'F');
foreach ($arr as $val) {
    if ($val == 'B') {
        break;    /* or 'break 1;' */
    }
    echo "$val
\n"; } //output: A

Example - break 2, exit from the both loops

//outer loop
for($i=1;$i<=5;$i++){
	//inner loop
	for($j=$i;$i<=5;$j++){
	    echo "$i $j";
		if($j==3) break 2; 
	}
}
/*
output: 
1 1
1 2
1 3*/