This article has some great overall advice. My only disappointment is that #10 isn’t higher on the list:
The single most important thing I tell people who use PHP is to turn error reporting to its maximum level. Why would I want to do this? Generally the error reporting is set at a level that will hide many little things like:
- declaring a variable ahead of time,
- referencing a variable that isn’t available in that segment of code, or
- using a define that isn’t set.
These factors might not seem like that big a deal — until you develop structured or object oriented programs with functions and classes. Too often, writing code without error reporting turned up high would cost you hours as you scoured long functions that didn’t work because a variable was misspelled or not accessible.
I highly recommend reading this article for any PHP developer.