", "cyan"); echo SS_Cli::start_colour("yellow"); $command = trim(fgets(STDIN, 4096)); echo SS_Cli::end_colour(); if ( $command == 'help' || $command == '?' ) { print "help or ? to exit\n" ; print "quit or \q to exit\n" ; print "install PHP_Shell for a more advanced interface with" . " auto-completion and readline support\n\n" ; continue ; } if ( $command == 'quit' || $command == '\q' ) break ; // Simple command processing if(substr($command,-1) == ';') $command = substr($command,0,-1); $is_print = preg_match('/^\s*print/i', $command); $is_return = preg_match('/^\s*return/i', $command); if(!$is_print && !$is_return) $command = "return ($command)"; $command .= ";"; try { $result = eval($command); if(!$is_print) print_r($result); echo "\n"; } catch( Exception $__repl_exception ) { echo SS_Cli::start_colour("red"); printf( '%s (code: %d) got thrown'.PHP_EOL, get_class($__repl_exception), $__repl_exception->getCode() ); print $__repl_exception; echo "\n"; } } } } }