mirror of
https://github.com/danog/amp.git
synced 2024-12-02 17:37:50 +01:00
37 lines
405 B
PHP
37 lines
405 B
PHP
<?php
|
|
|
|
require __DIR__ . '/../vendor/autoload.php';
|
|
|
|
use function Amp\async;
|
|
use function Amp\delay;
|
|
|
|
$future1 = async(function () {
|
|
delay(1);
|
|
|
|
print 'b';
|
|
});
|
|
|
|
$future2 = async(function () {
|
|
delay(2);
|
|
|
|
print 'c';
|
|
});
|
|
|
|
$future3 = async(function () {
|
|
delay(0.5);
|
|
|
|
print 'a';
|
|
});
|
|
|
|
$future1->await();
|
|
$future2->await();
|
|
$future3->await();
|
|
|
|
delay(1);
|
|
|
|
print 'd';
|
|
|
|
delay(1);
|
|
|
|
print 'e';
|