-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.php
More file actions
32 lines (24 loc) · 726 Bytes
/
Copy pathrun.php
File metadata and controls
32 lines (24 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
namespace Playground;
use Amp\Deferred;
use Interop\Async\EventLoop\EventLoop;
require __DIR__ . "/vendor/autoload.php";
EventLoop::execute(function () {
$deferred = new Deferred;
$deferred->promise()->when(function($error, $value) {
if ($error) {
var_dump($error);
} else {
var_dump($value);
}
});
EventLoop::execute(function () {
var_dump(__LINE__);
EventLoop::execute(function () {
var_dump(__LINE__);
}, new AmpDriver(\Amp\driver()));
}, new AmpDriver(\Amp\driver()));
EventLoop::delay(function() use ($deferred) {
$deferred->succeed(__LINE__);
}, 1000);
}, new AmpDriver(\Amp\driver()));