• 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 can I format this number correctly using PHP?

laravel 5.6 bulk inserting json data

Encrypt in php and decrypt in Dart(flutter)

Laravel Command Schedule Not Working Properly

how can I set a session variable in Drupal 8 and get it in a php script?

Laravel Unresolvable dependency resolving [Parameter #0 [ <required> $method ]] in class GuzzleHttpPsr7Request

how to search for a file with php

dompdf and img tag, image wont show

Apply filter array/return terms

getting error while enter Command => php artisan route:list

Laravel MSSQL Server Connection not working

Problem with fetching data from database in Laravel

phpseclib 2.0 can not use Composer to create autoload

Laravel Model save() & update() Not Saving

How to validate tin and cst using PHP?

About Contact Privacy policy Terms and conditions