If I want to try out something new in Ruby or Javascript, I love getting immediate feedback from irb
or the JS console in Firebug.
Is there anything like that for PHP?
Update
As @bernie po开发者_Go百科inted out, such tools are called REPLs - "Read-eval-print loop"
Run php -a
in the command-line. But this does not work on Windows.
For Windows, you may want to try phpa-norl.
Yes, there is a way: php -a, -a means interactive shell
php -a is the closest thing I know of but it's not quite like irb. irb will execute each line at a time. php -a will wait until you press ctrl-D (for end of line) and will then execute all lines.
How about phpsh? It's not fully compatible with PHP, but it represents a serious effort.
http://www.phpsh.org
Boris
I'm not working with PHP currently, but I just spotted this online and remembered I had once asked this question. Boris looks very nice.
https://github.com/d11wtq/boris
If you have a Mac, I find the PHP Code Tester program a much better way to accomplish the same thing: http://www.macupdate.com/app/mac/37328/php-code-tester
精彩评论