Code Structure and Documentation

Quality code structure and documentation is truly at the core of advanced PHP programming even though it will not affect how well your applications function. Proper structure and documentation is something that should be incorporated into code for your own good, for your client's, for your co-workers' (if applicable), and for the programmer in the future who may have to alter or augment your work.

When I refer to code structure, I mean physically how your PHP is organized within the document itself. (In Chapter 5, Developing Web Applications, I'll discuss the larger issue of site structure.) Compare Scripts 1.1 and 1.2: Both are valid PHP documents, but which would you rather review and possibly edit?

Script 1.1. ...

Get PHP Advanced for the World Wide Web: Visual QuickPro Guide 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.