Net.Tuts+ recently published an interesting article by Jason Lengstorf. It deals with the separation of PHP code into three tiers, database, processing, and display. (Much like the MVC approach to programming.)
It might not be immediately obvious, but separating your applications into a tiered structure will have a huge impact on your code’s ability to change in the future. For example, if you have a blogging system set up, and it becomes necessary to create an RSS feed for the blog, a properly tiered application would allow you to simply set up an RSS template, then call the database and business functions that you’ve already written.
On the opposite end, if your client suddenly decided that PostgreSQL was a better choice for their organization than MySQL, you would only have to rewrite your database functions, all without touching the business or presentation logic of the application.
This ties-in well with object-oriented programming, of course. By separating your logic into meaningful classes, making it more reusable, your code will end up being much cleaner and more manageable.
If you’ve mastered the basics of PHP, and have moved on to more advanced projects, this is something that is definitely worth reading about.
Add Power to Your PHP With Multi-Tiered Applications [Net.Tuts+]