Nathan Long
Nathan Long

Reputation: 126012

Does PHP have anything like Ruby's irb?

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 pointed out, such tools are called REPLs - "Read-eval-print loop"

Upvotes: 18

Views: 4182

Answers (6)

sutch
sutch

Reputation: 1295

Run php -a in the command-line. But this does not work on Windows.

For Windows, you may want to try phpa-norl.

Upvotes: 16

Nathan Long
Nathan Long

Reputation: 126012

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

Upvotes: 3

Foo Bah
Foo Bah

Reputation: 26271

How about phpsh? It's not fully compatible with PHP, but it represents a serious effort.

http://www.phpsh.org

Upvotes: 3

neurodynamic
neurodynamic

Reputation: 4404

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

Upvotes: 1

ABCD.ca
ABCD.ca

Reputation: 2505

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.

Upvotes: 3

Dan Sosedoff
Dan Sosedoff

Reputation: 2869

Yes, there is a way: php -a, -a means interactive shell

Upvotes: 9

Related Questions