PHP code example of oasis / multitasking
1. Go to this page and download the library: Download oasis/multitasking 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/ */
oasis / multitasking example snippets
$man = new BackgroundWorkerManager(2);
$man->addWorker(
function (WorkerInfo $info) {
echo sprintf(
"This is the #%d worker executed out of a total of %d",
$info->currentWorkerIndex,
$info->totalWorkers
);
},
10
); // add 10 workers to the manager
$man->run(); // all workers will be executed in order, no more than 2 workes will be running at the same time
$man->wait();