• 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

Woocommerce redirect after add-to-cart error

Using PHP to connect to a remote MSSQL database

PHP: set a (deep) array key from an array [closed]

Autoloading classes in PHPUnit using Composer and autoload.php

Unit (real unit test) of test laravel relationship

file_get_contents() without "Http" to access external URL [closed]

How to submit the custom form data in database in WordPress without plugin using ajax?

Generate random username based on full name php

CodeIgniter 4: Like and Dislike Functionality

How can I pass the list to the component variable in Laravel?

Can't call javascript alert alertify library from PHP

api response laravel doesn't show

Sentry on Symfony: how to exclude `NotFoundHttpException`

Stop caching for PHP 5.5.3 in MAMP

Move a child array to parent array and change parent/child name

About Contact Privacy policy Terms and conditions