• 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

In PHP, which is faster: preg_split or explode?

CSV to PHP class properties

MySQL order by field in Eloquent

Laravel Unknown Column 'updated_at'

Laravel with App Engine Standard Class 'FacadeIgnitionIgnitionServiceProvider' not found

Get lat/lon from google maps url ftid (hex)

array_map triple dimensional array [duplicate]

How to submit a form when page loads using JavaScript?

how to get the header value, if we don't know the value because the value is random from the server

php retrieve specific data onclick from database in a list format

javascript html popup window

Create a new line whenever an array value reaches more than 10 characters

How to solve cURL error 60: SSL certificate in Laravel 5 while Facebook authentication

How to get array values using foreach in laravel

How to skip cart page on woocomerce for certain products only?

About Contact Privacy policy Terms and conditions