Home arrow PHP arrow PHP Application Development Part One

PHP Application Development Part One

Settling for the "quick and dirty" solution often costs far more time than it saves. This is as true of PHP coding practices as anything else. In this first article in the series, you will learn practices that will save you time and headaches in the long run, and help you write better PHP code.

  1. PHP Application Development Part One
  2. Directory structure
  3. File naming conventions
  4. Coding conventions
  5. PHP coding conventions
  6. Conclusion
By: David Fells
Rating: starstarstarstarstar / 106
March 01, 2005

print this article



When building applications in PHP, it is often far too simple to settle for the “quick and dirty” solution – poorly written, monolithic code that will never be used again and lacks any clear intent. Since PHP is typically used in small projects that could themselves be described as “quick and dirty,” developers will excuse their poor code by stating that they will not have to work on the code again and that they have no intention of ever reusing it. The fact remains, however, that as with any job worth doing, it should be done well.

This paradigm holds true in this situation for a number of reasons. First, when you take the time to write good code, you will almost always find something reusable in any new code you write. Second, code will always require maintenance or changes. It may not be you, but it will be someone, someday – that is of course unless the code is so bad the poor fellow has to start from scratch. The intent of this article is to cover some of the most fundamental, low level rules of writing good PHP code.

The first practice we will discuss covers directory structure and security along with filesystem naming conventions for PHP applications. After that, we will cover some coding conventions such as function and variable naming, indentation, and more. Lastly we will review basic coding considerations to provide flexibility, scalability, and efficiency. Before beginning, let it be understood that some of the conventions advocated in this article could be considered a matter of preference and are by no means the single correct solution, however they are time tested and have proven effective time and again in application development.

>>> More PHP Articles          >>> More By David Fells

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: