Interactive mode not very useful

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm running PHP 5.2.6 on WindowsXP. When I try interactive mode with
">php -a" the slightest syntax error throws me out of the interpreter
and back to the command line. This is not very useful. Isn't there a
way to stay in interactive mode after a syntax error?

Re: Interactive mode not very useful

Quoted text here. Click to load it

No - that's not how PHP works. Indeed, apart from a very old version
of Forth, it's not how any programming language I've ever used works.
Try editing the file first then running it.


Re: Interactive mode not very useful

Sal wrote:
Quoted text here. Click to load it

Not really.  But then if you have a syntax error, your code can't be
executed anyway, so why stay in the interpreter?  It would be nice if it
let you correct the error, but it doesn't.  That's why I seldom use the
interpreter in interactive mode, and even then only for programs of a
few lines.

In Windows, once you've reentered the interpreter, you can use the
up/down arrow keys to scroll through the keyboard buffer.  When you're
in the interpreter you'll have the lines previously entered in the
buffer.  A bit awkward, but it does help a little.

Otherwise, I just use an editor to create a file and leave the editor
window open while I test the script.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Site Timeline