PDA

View Full Version : Top 21 Php Programming Mistakes



Jeff
03-27-2004, 08:47 PM
I'm not a PHP programmer, so I don't know if Zend.com is providing good advice or not with this site that lists the Top 21 PHP Programming Mistakes. Being community-minded, I thought I would share it here for the benefit of the folks who are PHP programmers. :)


Intended Audience

This article is intended for the PHP programmer interested in avoiding some of the most common mistakes when applying PHP. The reader is expected to at least be familiar with PHP syntax, but should have a working knowledge of PHP functionality.


Introduction

One of PHP's greatest strengths happens to be one of its greatest weaknesses as well: PHP is easy to learn. A lot of people are attracted to the language because of this, not realizing that it's a lot tougher to learn how to do it right.


There just hasn't been enough emphasis on good programming practice. Inexperienced coders are being asked to create and distribute complex web applications. Mistakes that an experienced programmer would avoid are all over the place, such as the improper use of the printf()functions or the misapplication of PHP's semantics.


In this three part article series, I'll present a list of 21 mistakes that I believe are frequently made and ranging in severity from non-critical down to those that can break the farm. I will then offer solutions, suggestions and/or comments on how to solve and prevent these errors, in addition to other tricks of the trade that I have gained over the years.


The series is comprised of the following three articles:

Part 1: Covers the first 7 "textbook" mistakes (http://www.zend.com/zend/art/mistake.php) (#21-15, in reverse order of severity) on our rating list. Committing one of these mistakes, while not critical, will lead to slower and less maintainable code.

Part 2: Covers the next 7 "serious" mistakes, (http://www.zend.com/zend/art/mistake1.php) representing # 14-8 on our rating list. Committing one of these mistakes will lead to drastically slower run times and less secure scripts, in addition to less maintainable code.

Part 3: Covers the last 7 "deadly" mistakes. (http://www.zend.com/zend/art/mistake2.php) These mistakes are conceptual in nature and can represent the root cause for committing any one of the mistakes listed in Series Parts I and II. They include blunders such as not allotting enough time for a project and not having a thorough code review.