Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function processLinesGroup($linesGroup) {
- // do something with the group of input lines
- }
- function processInputLines($inputLines) {
- $linesGroup = array();
- $maxLines = 50;
- foreach ($inputLines as $line) {
- array_push($linesGroup, $line);
- // Process the group each time it's growing to N items
- if (count($linesGroup) === $maxLines) {
- processLinesGroup($linesGroup);
- $linesGroup = array();
- }
- }
- // Process the remaining items in the end
- if (!empty($linesGroup)) {
- processLinesGroup($linesGroup);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement