Posted By

gdonald on 09/27/06


Tagged

fast stdin


Versions (?)

PHP fast stdin


 / Published in: PHP
 

  1. #!/usr/bin/php
  2. <?php
  3.  
  4. exec( 'stty -icanon min 0 time 0' );
  5.  
  6. $stdin = fopen( 'php://stdin', 'r' );
  7.  
  8. while( 1 )
  9. {
  10. while ( false !== ( $char = fgetc( $stdin ) ) )
  11. {
  12. echo "\n$char\n";
  13. }
  14. }
  15.  
  16. ?>

Report this snippet  

You need to login to post a comment.