Last Updated: 11 May 2009
PHP Best Practices
Leave the slash (/) off URLs, file paths, etc.
At some point, you'll probably need to create constants with URLs or file paths. It's rather tempting to put a closing slash on the end, because it looks 'more complete', is fully qualified, etc. Don't do it! You'll end up finding yourself taking the slash off with
rtrim() or similar all the time. Better to just leave the slash off, and add it if you need it.
Use Native Database Extensions, not PDO, etc.
I generally recommend you use native PHP database extensions, and not an abstraction layer like PDO. Read why on the pgsql vs. mysqli vs. PDO vs. Zend_DB page.