Site icon Leonid Mamchenkov

Command line PHP

I’ve discovered two things about command line PHP today.  I’ll share them here just in case you missed them too.

First, the “-f” parameter is optional.  I’m not sure when the change happened, but I’m pretty sure back when I started using it, it was required.  Now, instead of “php -f some.php” you can run just “php some.php”.

Second, there is now an interactive PHP mode! This is something I wanted for years.  Prior to PHP I had experience with Perl and Python, both of which have interactive modes.  With PHP I had to resort to a gadzillion of tiny files with snippets of code.  Now I don’t have to anymore.  Just run “php -a” and type away.

Have a look at PHP command line options manual page.  Maybe you’ll discover something else.

Exit mobile version