On the IBM developerWorks website, there's a new article that works to show some of the benefits of working with PHP code on the command line and some helpful ways to debug the code.
Of course, just the fact that you can use PHP on the command line isn't necessarily the best reason for doing so. However, you might quickly find several pleasant surprises when you first begin to experiment with PHP in this way. [...] In fact, there's really nothing stopping you from using PHP as your Swiss Army knife for almost any given programming project.
They walk through the installation and a sample of the debugging before getting into the more complex methods of finding and fixing errors, using the PHP I/O channels and the creation of your first command-line script (including the use of arguments).