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

You might also like

Execute PHP code directly on command line
I always wondered if running PHP code directly in the command line could be posible and today, thanks...

Execute PHP code directly on command line
I always wondered if running PHP code directly in the command line could be posible and today, thanks...

Change your shell prompt
The same way we added colors to the text in terminal application in Mac OS X, you can change the default...

Install MongoDB and the PHP driver in CentOS
Install MongoDB serverCreate the /etc/yum.repos.d/mongodb-org-3.0.repo file with this content:name=MongoDB...

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.