• 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

Creating command to backup MySql database in Laravel

Input and output values for php into the browser?

Laravel 5.1 xmlHttpRequest AJAX POST TokenMismatchException

Laravel relationship belongsToMany with composite primary keys

The difference when using if statement true === something() vs something() === true [duplicate]

stay with the last 15 elements of an array [duplicate]

Laravel set default language not working

Form Validation and Submission to database

How to get array values using foreach in laravel

Laravel 5: Is there a non-case sensitive way to sort a collection by an attribute?

RabbitMQ PRECONDITION_FAILED - unknown delivery tag

How to use PHPCBF to fix one issue at a time?

Timber: Single post pagination does not work (wp_link_pages)

Currently Using CodeIgniter Framework i have an Error

Transpose multidimensional array and join values with commas

About Contact Privacy policy Terms and conditions