PHP code example of iripvanwinkle / queue-processes
1. Go to this page and download the library: Download iripvanwinkle/queue-processes library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
iripvanwinkle / queue-processes example snippets
php
$queue = new QueueProcesses();
foreach (range(1, 10) as $index) {
$queue->addCommand("echo $index", function ($type, $buffer) use (&$commonBuffer) {
$commonBuffer .= $buffer;
});
}
$queue->setLimit(2);
$queue->run();
echo $commonBuffer; // Output: 1\n2\n3\n4\n5\n6\n7\n8\n9\n10