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