fork(3) download
  1. <?php
  2.  
  3. readline_callback_handler_install('', function() { });
  4. while (true) {
  5. $r = array(STDIN);
  6. $w = NULL;
  7. $e = NULL;
  8. $n = stream_select($r, $w, $e, null);
  9. if ($n && in_array(STDIN, $r)) {
  10. $c = stream_get_contents(STDIN, 1);
  11. echo "Char read: $c\n";
  12. break;
  13. }
  14. }
  15.  
  16. ?>
Success #stdin #stdout 0.02s 52504KB
stdin
abcd
stdout
Char read: a