Multiple choice php

What does break; do?

  1. Ends execution of the current switch structure

  2. Moves on to the next iteration of the current for, foreach, while, do-while or switch structure

  3. Ends execution of the current for, foreach, while, do-while or switch structure

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The break statement is used to immediately terminate the execution of the current loop (for, foreach, while, do-while) or switch structure. Option 4424 is too narrow as it only mentions switch, and 4425 describes the continue statement, which skips to the next iteration rather than ending the structure.