PHP code example of spencer-mortensen / parallel-processor
1. Go to this page and download the library: Download spencer-mortensen/parallel-processor 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/ */
spencer-mortensen / parallel-processor example snippets
$processor = new ForkProcessor();
$t0 = microtime(true);
$processor->start(new SleepJob(2, $results[]));
$processor->start(new SleepJob(3, $results[]));
$processor->start(new SleepJob(1, $results[]));
$processor->finish();
$t1 = microtime(true);
echo implode("\n", $results), "\n";
echo "\nTotal time: ", $t1 - $t0, " seconds\n";