Skip to content

Collection of Helpful Guides & Tutorials!

Collection of Helpful Guides & Tutorials!
Menu
  • Home
  • C#
    • Tutorials
    • C# Projects
    • Q & A
  • HTML5
  • CSS3
  • PHP
    • Tutorials
    • Q & A
  • SQL
  • JavaScript
    • Tutorials
    • Q & A
  • jQuery
    • Tutorials
    • Q & A
  • Bootstrap
  • Guides
  • Tools
December 23, 2015
HomePHP QuestionsHow to Break For Loop in PHP

How to Break For Loop in PHP

By Krishnaa PHP Questions  0 Comments

To break for loop in PHP when a certain condition is met, we make use of break statement.

<?php
for ($i = 0; $i <= 10; $i++) {
    
    if($i == 5)
    {
        echo "The number is $i. <br>";
        break;       
    }    
}
?>

 

 
         

You May Also Like:

How to Break/Exit For Loop in C#/CSharp While Loop Break Statement Do While Loop For Loop

Recent Posts

  • Understanding Event Capturing and Event Bubbling: A Simple Explanation
  • Exploring the Difference Between let and var in JavaScript
  • Understanding Closures: A Beginner’s Guide
  • Understanding Dense and Sparse Arrays in JavaScript
  • Understanding the Difference Between Arrow Functions and Regular Functions in JavaScript

Useful Sites

  • Kody Tools
Privacy Policy
Collection of Helpful Guides & Tutorials! Copyright © 2025.
Back to Top ↑