Tag Archives: interactive shell

Execute PHP code as interactive shell

I explained before how to execute PHP code directly on command line, but if you are just doing some test it’s probably more handy to use the interactive shell. This is done by just using the -a option of PHP:

$ php -a
Interactive shell

php > echo "Hello World!" . PHP_EOL;
Hello World!
php > exit