PHP code example of sciangulahugo / php-async
1. Go to this page and download the library: Download sciangulahugo/php-async 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/ */
sciangulahugo / php-async example snippets
use SciangulaHugo\Closure\Async;
$start = microtime(true);
$async = new Async();
$async->create(function () {
sleep(10);
file_put_contents('output.txt', 'Hello World');
});
$async->run();
$end = microtime(true);
print_r("Time of execution: " . ($end - $start) . " seconds" . PHP_EOL);
// Imprime "Tiempo de ejecución: 0.006659984588623 segundos"
// El archivo output.txt se creó a las 10.006129026413 segundos después
bash
composer