1
0
mirror of https://github.com/danog/byte-stream.git synced 2024-12-02 09:17:50 +01:00
byte-stream/examples/readline-echo.php
2019-08-23 15:08:20 +02:00

16 lines
522 B
PHP

<?php
use Amp\Loop;
use function Amp\ByteStream\bufferEcho;
use function Amp\ByteStream\prompt;
require __DIR__ . "/../vendor/autoload.php";
Loop::run(function () {
yield bufferEcho("Hello from async PHP!\n");
$question = yield prompt("What is your question? ");
yield bufferEcho("I see your question is $question.\n");
yield bufferEcho("\nUnfortunately, I'm just a small script and I can't answer that, feel free to contact us at #amphp on freenode though!\n\n");
yield bufferEcho("Bye!\n\n");
});