Exemplo n.º 1
0
    public static function main($options = array())
    {
        $shell = new iphp($options);
        print <<<END

Welcome to the PHOCOA shell! The PHOCOA shell is a powerful interactive PHP shell for allowing you to experiment with your application interactively.

Features include:
- autocomplete (tab key)
- readline support w/history
- automatically wired into your project's autoload

Enter a php statement at the prompt, and it will be evaluated. The variable \$_ will contain the result.

Example:

> new WFArray(array(1,2))
Array:
  0 => 1
  1 => 2
END Array

> \$_[0] + 1
2


END;
        // readline history
        if (function_exists('readline_read_history')) {
            readline_read_history($shell->historyFile());
            // doesn't seem to work, even though readline_list_history() shows the read items!
        }
        // install tab-complete
        if (function_exists('readline_completion_function')) {
            readline_completion_function(array($shell, 'readlineCompleter'));
        }
        while (true) {
            $shell->doCommand($shell->readline());
        }
    }