Recall & Review
beginner
What does the
continue statement do in PHP loops?The
continue statement skips the rest of the current loop iteration and moves to the next iteration.Click to reveal answer
intermediate
What is the purpose of using
continue with a numeric argument (levels) in PHP?Using
continue with a number tells PHP to skip the rest of the current iteration of an outer loop that many levels up.Click to reveal answer
intermediate
How does
continue 2; behave inside nested loops?continue 2; skips the rest of the current iteration of the inner loop and also skips the rest of the current iteration of the outer loop, moving to the next iteration of the outer loop.Click to reveal answer
beginner
Can
continue be used outside of loops in PHP?No,
continue can only be used inside looping structures like for, foreach, while, and do-while loops.Click to reveal answer
advanced
What happens if you use
continue with a level number greater than the number of nested loops?PHP will generate a warning and treat it as a normal
continue (level 1), skipping only the current loop iteration.Click to reveal answer
What does
continue; do inside a loop?✗ Incorrect
continue; skips the rest of the current loop iteration and continues with the next iteration.What does
continue 2; do inside two nested loops?✗ Incorrect
continue 2; skips the rest of the current iteration of the inner loop and also the outer loop, moving to the next iteration of the outer loop.What happens if you use
continue 3; inside two nested loops?✗ Incorrect
Using a level greater than the number of nested loops causes PHP to treat it as
continue 1; and issue a warning.Can
continue be used inside a switch statement in PHP?✗ Incorrect
continue is designed for loops, not switch statements.Which of the following is a correct use of
continue with levels?✗ Incorrect
continue with levels is used inside nested loops to skip iterations of outer loops.Explain how the
continue statement with a numeric level works inside nested loops in PHP.Think about how many loops you want to skip ahead in.
You got /4 concepts.
Describe what happens if you use a
continue level number greater than the number of nested loops.Consider PHP's behavior when the level is too high.
You got /4 concepts.