SHARE
TWEET

Untitled

a guest Oct 13th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. function processLinesGroup($linesGroup) {
  4.     // do something with the group of input lines
  5. }
  6.  
  7. function processInputLines($inputLines) {
  8.     $linesGroup = array();
  9.     $maxLines = 50;
  10.  
  11.     foreach ($inputLines as $line) {
  12.         array_push($linesGroup, $line);
  13.  
  14.         // Process the group each time it's growing to N items
  15.         if (count($linesGroup) === $maxLines) {
  16.             processLinesGroup($linesGroup);
  17.             $linesGroup = array();
  18.         }
  19.     }
  20.  
  21.     // Process the remaining items in the end
  22.     if (!empty($linesGroup)) {
  23.         processLinesGroup($linesGroup);
  24.     }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top