Remember: PHP is scripting language!: Some good advice that people tend to forget.
One of the oft-overlooked aspects of PHP is that you can write scripts in PHP to execute from the command line. I fell into the habit of writing data munging scripts in Perl, and web pages using PHP; I realized I was keeping alive two types of code needlessly.
Just remember that all your code still has to be in PHP delimters ().