Skip to content

Instantly share code, notes, and snippets.

@asgrim

asgrim/async.php

Last active Jun 30, 2017
Embed
What would you like to do?
<?php
class x {
async public function highlightFileContents($path) : string {
$source = await Amp\File\get($path);
return highlight_string($source, true);
}
}
$highlighted = Amp\wait((new x())->highlightFileContents("helpers.php"));
var_dump($highlighted);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment