Created
October 7, 2014 06:24
-
-
Save turanct/c725739b7aaa8f136d12 to your computer and use it in GitHub Desktop.
a PHP REPL in a tweet
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 | |
while(1){echo"> ";$i=rtrim(stream_get_line(STDIN,512,PHP_EOL),';');try{@eval('print_r('.$i.');');}catch(Exception$e){print_r($e);}echo"\n";} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PHP REPL in a tweet
see https://twitter.com/tinydroptest2/status/519371916990484480
Usage
Stand-alone
Just run the script, and a repl will start:
With pre-defined context
If you want to run the repl inside some predefined context (to inspect some values, etc...), do it like this:
$foo
and hit enter to see 'bar'!exit
to stop the REPL and the script, or typebreak
to stop the REPL but let the code after the REPL executeisn't that awesome?
Other php awesomeness in a tweet: