• 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

Cut an arabic string

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

Limit WooCommerce products in cart only from one custom taxonomy

How to make Canonicals with PHP

Remove country code from phone number?

Input and output values for php into the browser?

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

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

How to prevent phpmailer sending embedded image as an attachment on Gmail?

Combine multiple columns into an array as one of the key in a results set

PHP mail sending empty mails

MISSING UPDATES FOR: MEDIA Drupal 9

HTML + PHP + PHPMAILER

Warning file_get_contents () failed to open stream: HTTP request failed! HTTP/1.0 402 Payment Required

Additional price based on cart item count in WooCommerce

About Contact Privacy policy Terms and conditions