测试PHP代码的快捷方式

Having a python interpreter is really useful as it lets you quickly type in few commands and verify output; making it easier to understand syntax.

However, in PHP, every time I want to try something out I have to - create a PHP script, save it, run it in my browser.

Is there a shortcut that I am missing out on for PHP that would make things simpler?

You can run php CLI in interactive mode ;)

php -a 

in interactive mode you need to type the script with start and end tags

<?php echo 'Hello!'; ?>

Use PHP Designer. It will make your job much easier.

Or you could use phpUnit , unit testing for php