1
0
mirror of https://github.com/danog/byte-stream.git synced 2024-12-02 17:28:21 +01:00
byte-stream/examples/readline-echo.php

19 lines
644 B
PHP
Raw Normal View History

<?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\readLine;
require __DIR__ . "/../vendor/autoload.php";
Loop::run(function () {
yield bufferEcho("Hello from async PHP!\n");
$question = yield readLine("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");
});