Skip to content

Instantly share code, notes, and snippets.

@abnrk
Last active August 6, 2026 11:38
Show Gist options
  • Select an option

  • Save abnrk/77fefd83b2563b92a4126eac9acaa929 to your computer and use it in GitHub Desktop.

Select an option

Save abnrk/77fefd83b2563b92a4126eac9acaa929 to your computer and use it in GitHub Desktop.
Simple PHP REPL script
<?php
while(1) {
echo "> ";
$code = fgets(STDIN);
try {
$result = eval('return '.$code.";");
} catch(ParseError $e) {
$result = eval($code);
}
if($result) echo var_export($result);
echo "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment