3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?hh namespace Hack\UserDocumentation\Async\Intro\Examples\Curl; async function curl_A(): Awaitable<string> { return await \HH\Asio\curl_exec("http://example.com/"); } async function curl_B(): Awaitable<string> { return await \HH\Asio\curl_exec("http://example.net/"); } async function async_curl(): Awaitable<void> { $start = microtime(true); list($a, $b) = await \HH\Asio\v(array(curl_A(), curl_B())); $end = microtime(true); echo "Total time taken: " . strval($end - $start) . " seconds" . PHP_EOL; var_dump($a, $b); } \HH\Asio\join(async_curl());
based on OQ9dd
Output for 5.4.10 - 7.0.0
Parse error: syntax error, unexpected 'namespace' (T_NAMESPACE) in /in/qkav8 on line 3
Process exited with code 255.
Output for 5.3.20 - 5.3.29
<?hh namespace Hack\UserDocumentation\Async\Intro\Examples\Curl; async function curl_A(): Awaitable<string> { return await \HH\Asio\curl_exec("http://example.com/"); } async function curl_B(): Awaitable<string> { return await \HH\Asio\curl_exec("http://example.net/"); } async function async_curl(): Awaitable<void> { $start = microtime(true); list($a, $b) = await \HH\Asio\v(array(curl_A(), curl_B())); $end = microtime(true); echo "Total time taken: " . strval($end - $start) . " seconds" . PHP_EOL; var_dump($a, $b); } \HH\Asio\join(async_curl());