DevShed has posted an excerpt from the book "Advanced PHP Programming" from George Schlossnagle as this new tutorial detailing the creation of standalone PHP scripts.
If you've ever been interested in making significant use of PHP outside of a web environment, this article will show you how. The first of three parts.
This chapter describes how to reuse existing code libraries to perform administrative tasks in PHP and how to write standalone and one-liner scripts. It gives a couple extremely paradigm-breaking projects that put PHP to use outside the Web environment.
In this first part, they groundwork is laid - they introduce the CLI interface PHP already has and show how to handle input/output and work with parsing the command line arguments passed in.