Chapter 6: Structured PHP Programming
Before we plow headlong into the next enhancements of our joke
database, let’s spend a little time honing your “PHP-fu”. Specifically, I want to show you a few techniques to better structure your code.
Structured coding techniques are useful in all but the simplest of PHP projects. In Chapter 2, we looked at how to split our PHP code into multiple files, using a controller and a set of associated templates. This lets us keep the server-side logic of our site separate from the HTML code used to display the dynamic content generated by that logic. In order to do this, we looked at how to use the PHP include
command.
The PHP language offers many such facilities to help you add structure to your code. The most ...
Get PHP & MySQL: Novice to Ninja, 7th Edition 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.