diff --git a/features/commandline.xml b/features/commandline.xml index 7016f7a792..5eb897cf72 100644 --- a/features/commandline.xml +++ b/features/commandline.xml @@ -366,29 +366,10 @@ Usage: php [options] [-f] [--] [args...] --interactive - Runs PHP interactively. If you compile PHP with the Readline extension (which is not - available on Windows), you'll have a nice shell, including a - completion feature (e.g. you can start typing a variable name, hit the - TAB key and PHP completes its name) and a typing history that can be - accessed using the arrow keys. The history is saved in the - ~/.php_history file. + Runs PHP interactively. For more information, see the Interactive shell + section. - - - Files included through auto_prepend_file and auto_append_file are parsed in - this mode but with some restrictions - e.g. functions have to be - defined before called. - - - - - Autoloading is not - available if using PHP in &cli; interactive mode. - - @@ -1389,6 +1370,159 @@ php -r 'fwrite(STDERR, "stderr\n");' + + +
+ Interactive shell + + + As of PHP 5.1.0, the &cli.sapi; provides an interactive shell using the + option if PHP is compiled with the option. + + + + Using the interactive shell you are able to type PHP code and have it + executed directly. + + + + Executing code using the interactive shell + + echo 5+8; +13 +php > function addTwo($n) +php > { +php { return $n + 2; +php { } +php > var_dump(addtwo(2)); +int(4) +php > +]]> + + + + + The interactive shell also features tab completion for functions, + constants, class names, variables, static method calls and class + constants. + + + + Tab completion + + Pressing the tab key twice when there are multiple possible completions + will result in a list of these completions: + + + strp[TAB][TAB] +strpbrk strpos strptime +php > strp +]]> + + + When there is only one possible completion, pressing tab once will + complete the rest on the same line: + + + strpt[TAB]ime( +]]> + + + It is also possible doing completion on things that have been defined + during the interactive shell session: + + + $fooThisIsAReallyLongVariableName = 42; +php > $foo[TAB]ThisIsAReallyLongVariableName +]]> + + + + + The interactive shell stores your history and can be accessed using the up + and down keys. The history is saved in the + ~/.php_history file. + + + + + + + Files included through auto_prepend_file and auto_append_file are parsed in + this mode but with some restrictions - e.g. functions have to be + defined before called. + + + + + + Autoloading is not + available if using PHP in &cli; interactive mode. + + +
+ @@ -1408,7 +1542,7 @@ sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: -vim600: syn=xml fen fdm=syntax fdl=2 si +vim600: syn=xml fen fdm=marker fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->