Skip to content

Instantly share code, notes, and snippets.

@kahagon
Created February 12, 2013 17:05
Show Gist options
  • Select an option

  • Save kahagon/4771380 to your computer and use it in GitHub Desktop.

Select an option

Save kahagon/4771380 to your computer and use it in GitHub Desktop.
PHP REPL script.
#!/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 = '';
}
}
@xeoncross
Copy link
Copy Markdown

I forked this and added code highlighting to your script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment