Created
February 12, 2013 17:05
-
-
Save kahagon/4771380 to your computer and use it in GitHub Desktop.
PHP REPL script.
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
| #!/usr/bin/env php | |
| <?php | |
| $stdin = fopen('php://stdin', 'r'); | |
| $data = ''; | |
| while(true) { | |
| print '> '; | |
| $data .= fgets($stdin); | |
| if (preg_match('/\\\\$/', $data)==1) { | |
| $data = trim($data, "\x00..\x1F \x5C"); | |
| } else { | |
| eval($data); | |
| $data = ''; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I forked this and added code highlighting to your script.