Chapter 6Structured 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. Already in Chapter 3, you’ve learned how to split
up your PHP code into multiple files: a controller and a set of associated
templates. This lets you keep the server-side logic of your site separate
from the HTML code used to display the dynamic content generated by that
logic. In order to do this, you learned how to use the PHP
include
command.
The PHP language offers many such facilities to help you add structure to your code. ...
Get PHP & MySQL: Novice to Ninja, 5th 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.