PHP Best Practices

PHP Best Practices

“PHP Best Practices: A short, practical guide for common and confusing PHP tasks” is an attempt to compile a set of basic instructions for what can be considered best practices for common and confusing issues and tasks in PHP. If a low-level task has multiple and confusing approaches in PHP, it belongs here.


It’s a guide suggesting the best direction to take when facing one of the common low-level tasks a PHP programmer might encounter that are unclear because of the many options PHP might offer. For example: connecting to a database is a common task with a large amount of possible solutions in PHP, not all of them good ones—thus, it’s included in this document.
It’s a series of short, introductory solutions. Examples should get you up and running in a basic setting, and you should do your own research to flesh them out into something useful to you.

Table of Contents

  • Introduction
  • Storing passwords
  • PHP and MySQL
  • PHP tags
  • Auto-loading classes
  • Single vs. double quotes
  • Caching PHP opcode
  • PHP and Memcached
  • PHP and regex
  • Serving PHP
  • Sending email
  • Validating email addresses
  • Sanitizing HTML
  • PHP and UTF-8
  • Checking null and false values
  • Suggestions and corrections

Book Details

Author(s): Alex Cabal
Format(s): HTML(Online)
Link: Read online.

Leave a Reply