Using the interactive shell you are able to type PHP code and have it executed directly.
php -a 像 python 一样在 shell 调试 PHP

Executing code using the interactive shell

$ php -a
Interactive mode enabled

php > echo 5+8;
13
php > function addTwo($n)
php > {
php { return $n + 2;
php { }
php > var_dump(addtwo(2));
int(4)
php >

Tab completion

The interactive shell also features tab completion for functions, constants, class names, variables, static method calls and class constants.
交互式 shell 还具有函数、常量、类名、变量、静态方法调用和类常量的 tab 补全功能

php > strp[TAB][TAB]
strpbrk strpos strptime
php > strp

reference: