PHP - LoopsWhat does the continue 2; statement do inside nested loops in PHP?AExits both loops immediatelyBSkips the rest of the current iteration of the inner loop and continues with the next iteration of the outer loopCSkips only the current iteration of the inner loopDRestarts the entire script from the beginningCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand the meaning of continue with a numberThe number after continue tells PHP how many nested loops to skip to the next iteration.Step 2: Apply continue 2 in nested loopscontinue 2 skips the current iteration of the inner loop and also skips to the next iteration of the outer loop.Final Answer:Skips the rest of the current iteration of the inner loop and continues with the next iteration of the outer loop -> Option BQuick Check:continue 2 = skip inner and outer loop iteration [OK]Quick Trick: continue n skips n nested loops' current iterations [OK]Common Mistakes:Thinking continue 2 exits both loopsConfusing continue with breakAssuming continue 2 only affects inner loop
Master "Loops" in PHP9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PHP Quizzes Arrays - Array search functions - Quiz 5medium Conditional Statements - If-else execution flow - Quiz 11easy Functions - Why functions are needed - Quiz 5medium Functions - Nullable types in functions - Quiz 13medium Operators - Null coalescing operator - Quiz 12easy Output and String Handling - Echo vs print behavior - Quiz 5medium Output and String Handling - Heredoc and nowdoc syntax - Quiz 4medium PHP Basics and Execution Model - PHP CLI vs web server execution - Quiz 13medium PHP Request Lifecycle - How a PHP request starts and ends - Quiz 11easy Variables and Data Types - Type juggling in PHP - Quiz 2easy