PHP。 读取后,Echo不能在无限循环中工作

I'm trying write simple script which will work from console, but I ran into a problem. Echo in my case does not work. But when I delete the line: readline ('Command:'), it starts working as expected, so I tried to replace echo with print_r, but that did not help. I launch a script from the Windows console.

<?php
while (true){
    $input = readline('Command: ');
    $input = strtolower($input);
    echo $input;                    //don't work
    switch ($input){
        case 'stop':
            exit(0);
            break;
        case '1':
            echo 1;                //don't work
            break;
        default:
            echo 'Command ' . $input . ' not found.';  //don't work
    }
}

From the user comments on the documentation - http://php.net/manual/en/function.readline.php#104181 ...

The readline library is not available on Windows.

if (PHP_OS == 'WINNT') {
  echo '$ ';
  $line = stream_get_line(STDIN, 1024, PHP_EOL);
} else {
  $line = readline('$ ');
}

So try

  echo 'Command: ';
  $input = stream_get_line(STDIN, 1024, PHP_EOL);

As has been pointed out, as of PHP 7.1, this function is available on Windows, but prior to that it looks as though you can do the above.