PHP coding standards and best practices

I have been using PHP for a long time now, it’s a very flexible language, and is a good platform.

Over the years PHP coders have gotten a very bad reputation mainly due to poor coding and not escaping SQL.

One way to improve the over-all quality of a product, help reduce problems, help increase productivity and development, and make life a little easier in the long run is to stick to the PEAR coding standards as closely as possible.

PEAR is a library of useful classes for PHP, as an attempt to help users from re-inventing the wheel to achieve the same task. PEAR has grown larger over the years and has many packages on offer, as such like everyone else some packages in PEAR had common problems. The PEAR team decided it was best to employ coding standards for everyone to work to.

I believe all projects should take the same approach, and stick to one set of coding standards, as this will solve many common problems, in-particular with applications which have more than one developer.

Not only this but it its always worth learning about the PHP best practices (Use left and right keys to scroll through the pages), although you do not have to follow the best practices, some of the suggestions are worth taking note of.

This is only a short article, but I don’t think much more needs to be said. Follow the links, and ensure you attempt to stick to the guide lines, and you’ll do all right.

Related posts:

  1. 50+ PHP optimisation tips revisited After reading an article some time ago entitled “40 Tips...
  2. PHPbase web framework What is the PHPbase web framework? PHPbase web framework (also...

Leave a Comment