Site menu

CodeCook.io

  • Languages
    • C
    • C++
    • CSS
    • Git
    • HTML
    • Java
    • JavaScript
    • jQuery
    • PHP
    • Python
    • Ruby
    • Scala
  • control
  • for
  • loop
  • while

PHP - Break out of loop

Immediately exit a looping section regardless if loop condition is true.

Note: generally it is better to adjust the loop condition so the loop exits naturally when a specific situation occurs.

0
414
  • Share on Facebook
  • Share on Google+
  • Share on Twitter

documentation

break;
php

Notes

last update: Nov. 14, 2014

Advertisement

This project is hosted on DigitalOcean, try it and support us

Related concept

  • Inline conditional
  • Loop while condition is true
  • If, else if, else
  • Counter loop
  • Loop until condition is true
  • Do loop while a condition is true

Other language

  • Scala
  • Python
  • JavaScript

Random task

  • Get random item from array
  • Get DOM element data attribute
  • Object inner function
  • List existing tags
  • Static share link for social network
  • Blog
  • About
  • License