= 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. // don't include trailing slashes in URL or path constants define('MY_URL', 'http://www.startupcto.com'); define('MY_PATH', '/var/www/html/documents'); == 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 [[mysqli-vs-pgsql-vs-pdo-vs-zend_db|pgsql vs. mysqli vs. PDO vs. Zend_DB]] page.