Last active
August 29, 2015 14:16
-
-
Save PEMapModder/f3e3fe8beb816516845f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require_once("readline.php"); | |
| $thread = new ConsoleThread; | |
| $thread->start(); | |
| while(true){ | |
| sleep(10); | |
| echo "I am still alive!" . PHP_EOL; | |
| } | |
| class ConsoleThread extends Thread{ | |
| public function run(){ | |
| loopConsole(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if(!defined("STDIN")){ | |
| define("STDIN", fopen("php://stdin", "rt")); | |
| } | |
| function loopConsole(){ | |
| while(true){ | |
| $line = trim(fgets(STDIN)); | |
| echo $line . PHP_EOL; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment