• 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

PHP: Convert any string to UTF-8 without knowing the original character set, or at least try

Installing Composer - Internal Error

Results page in other window

Laravel-fopen: failed to open stream: Permission denied

How to fix bootstrap multiselect search data using ajax

Combining a describing and one array with data

Laravel database insert with combining array and string

Mysqli Output to a table

Shopify password update using Shopify API

How to write PHP in XSLT

Dropdown with current value from Mysql

Composer fails with kylekatarnls/update-helper on new homestead

add_action() function in wordpress not working [duplicate]

Group data in a multidimensional array based on two columns

How to insert data from multiple select dropdown values into database?

About Contact Privacy policy Terms and conditions