php-async/bin/example/arrays.php
Joop Schilder c0cfaadcc3 Made the code more robust.
Extended functionality with helper functions.
2019-01-16 16:22:02 +01:00

16 lines
277 B
PHP
Executable File

#!/usr/bin/php
<?php
use function Joop\Asynchronous\async;
require_once __DIR__ . '/../../vendor/autoload.php';
$promise = async(function () {
sleep(1);
return range(random_int(0, 10), random_int(20, 60));
});
$array = $promise->resolve()->getValue();
var_dump($array);