Bird
0
0

Which of the following PHP statements correctly skips the current iteration of the outer loop when inside two nested loops?

easy📝 Syntax Q3 of 15
PHP - Loops

Which of the following PHP statements correctly skips the current iteration of the outer loop when inside two nested loops?

A<code>continue 2;</code>
B<code>continue;</code>
C<code>continue 1;</code>
D<code>break 2;</code>
Step-by-Step Solution
Solution:
  1. Step 1: Recognize the syntax

    In PHP, continue can take an optional numeric argument indicating how many nested loops to skip.
  2. Step 2: Correct usage

    continue 2; skips the current iteration of the outer loop when inside two nested loops.
  3. Final Answer:

    continue 2; -> Option A
  4. Quick Check:

    Use numeric argument with continue to skip outer loops [OK]
Quick Trick: continue 2; skips outer loop iteration inside nested loops [OK]
Common Mistakes:
  • Using continue without number skips only inner loop
  • Using break instead of continue
  • Using continue with wrong numeric argument

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes