• 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

How to make a array inside array?

file_put_content...fail to open stream:Permission denied in Laravel 5

laravel sanctum Route [login] not defined

Stop caching for PHP 5.5.3 in MAMP

Laravel views are showing from cache on one server but works fine on other server

How to edit Records using CodeIgniter

curl returning 301 error after migrating to https

How to show selected value using javascript in laravel

Laravel SQL query midnight time not showing

Dynamic dropdown Ajax PHP request

Convert regular text to array using notepad++

How to add a heading in between checkout fields of WooCommerce

Facebook SDK error: Cross-site request forgery validation failed. Required param "state" missing from persistent data

Implode array with array of glue strings

Laravel: HTML in notification

About Contact Privacy policy Terms and conditions