Chapter 1. Coding Styles


“Everything should be made as simple as possible, but not one bit simpler.”

 --Albert Einstein (1879–1955)

“Seek simplicity, and distrust it.”

 --Alfred North Whitehead (1861–1947)

No matter what your proficiency level in PHP, no matter how familiar you are with the language internals or the idiosyncrasies of various functions or syntaxes, it is easy to write sloppy or obfuscated code. Hard-to-read code is difficult to maintain and debug. Poor coding style connotes a lack of professionalism.

If you were to stay at a job the rest of your life and no one else had to maintain your code, it would still not be acceptable to write poorly structured code. Troubleshooting and augmenting libraries that I wrote two or three years ...

Get Advanced PHP Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.