Becoming a better PHP developer

There’s no denying that PHP is not the optimal language. But at least code in good PHP. Here’s my pet peeve for the day:

Relative paths in include(_once)? or require(_once)? statements.

require_once(dirname(__FILE__) . "/include_me.php");

Why? Basically, performance. PHP doesn’t look through all its search paths for absolute paths, saving those precious system calls. This effect is compounded when you’re using the APC cache with apc.stat = 0 (it won’t even cache files that are referred to with a relative path)