Question about PHP continue keyword

1. what is the role of "continue 2"? Please Explain with exaample

  • Snehal
  • 30 Aug 2018
  • 498 Views
  • 2 Answers
Your Answer

continue is used within looping structures to skip the rest of the current loop iteration and continue execution at the condition evaluation and then the beginning of the next iteration.
In PHP the switch statement is considered a looping structure for the purposes of continue. continue behaves like break (when no arguments are passed). If a switch is inside a loop, continue 2 will continue with the next iteration of the outer loop.
continue accepts an optional numeric argument which tells it how many levels of enclosing loops it should skip to the end of. The default value is 1, thus skipping to the end of the current loop.

Php

Didn't get the answer.
Contact people of Talent-Php directly by clicking here