#!/usr/bin/env php enqueue($task); $url = $task->getArgs()[0]; \printf("\nRead from %s: %d bytes\n", $url, \strlen($result)); $results[$url] = $result; }; } $coroutines = \array_map(function (callable $coroutine): Coroutine { return new Coroutine($coroutine()); }, $coroutines); yield Amp\Promise\all($coroutines); return yield $pool->shutdown(); }); echo "\nResult array keys:\n"; echo \var_export(\array_keys($results), true);