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-22 22:42:20 +02:00

19 lines
640 B
PHP

<?php
use Amp\ByteStream\ResourceInputStream;
use Amp\ByteStream\ResourceOutputStream;
use Amp\ByteStream\ZlibOutputStream;
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");
});