Complete the code to break out of the inner loop only.
<?php for ($i = 0; $i < 3; $i++) { for ($j = 0; $j < 3; $j++) { if ($j == 1) { [1]; } echo "$i$j "; } echo "\n"; } ?>
The break statement without a number breaks out of the innermost loop only.
Complete the code to break out of both loops when $j equals 1.
<?php for ($i = 0; $i < 3; $i++) { for ($j = 0; $j < 3; $j++) { if ($j == 1) { [1]; } echo "$i$j "; } echo "\n"; } ?>
The break 2 statement breaks out of two nested loops.
Fix the error in the break statement to exit three nested loops.
<?php for ($a = 0; $a < 2; $a++) { for ($b = 0; $b < 2; $b++) { for ($c = 0; $c < 2; $c++) { if ($c == 1) { [1]; } echo "$a$b$c "; } } echo "\n"; } ?>
To break out of three nested loops, use break 3.
Fill both blanks to break out of the correct number of loops and print the last value of $i.
<?php for ($i = 0; $i < 5; $i++) { for ($j = 0; $j < 5; $j++) { if ($j == 2) { [1]; } } } echo $[2]; ?>
break 2 exits both loops when $j equals 2, then echo $i; prints the current value of $i.
Fill all three blanks to break out of the correct loops and print the sum of $x and $y.
<?php for ($x = 0; $x < 4; $x++) { for ($y = 0; $y < 4; $y++) { if ($y == 3) { [1]; } echo "$x$y "; } } echo [2] + [3]; ?>
break 2 exits both loops when $y equals 3, then echo $x + $y; prints their sum.
