• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How to break out of a foreach once a condition is met?

phploopsforeachconditional


PHP Snippet 1:

if ($small_object->TIME == $sought_time) {
   break;       
}

PHP Snippet 2:

   $count = 0;
    ......
    ..
    ..
    ..
    ..
    ......    
    if (++$count == 5) break;

Related Snippets

Laravel SQL query midnight time not showing

How to fix bootstrap multiselect search data using ajax

phpmyadmin : Depends: php-twig (>= 2.9) but 2.6.2-2 is to be installed. WHAT?

I cannot create a auto generated date time in mysql workbench

How can I create a Download Page with post php method?

How to get array values using foreach in laravel

Laravel database insert with combining array and string

SQL AVG() to 2 decimals

How to extract price from given url using Xpath?

WHM Enabling mod_rewrite

Populate Dynamic Dropdowns List in Codeigniter

How do I Post to .txt document before form submits

Adding Multiple Custom Post Types in Wordpress

Loading data from MySQL and populating dropdown select with jQuery Mobile, PHP

Timber: Single post pagination does not work (wp_link_pages)

About Contact Privacy policy Terms and conditions