Next Steps
Modularizing your code by creating user-defined functions, and by aggregating those functions into classes and objects, can help you build code that is easy to read and maintain, and that enables you to make changes to the application in the most efficient manner.
This article focused on the details of creating and using user-defined functions and objects within PHP. If you're going to really move in this direction, it's a good idea to get a good grounding in object-oriented programming. Here are some starting points:
Coad, Peter and Edward Yourdon. Object Oriented Analysis. Prentice Hall PTR, 1991. (ISBN: 0136299814)
Sintes, Anthony. Sams Teach Yourself Object Oriented Programming in 21 Days. Sams, 2002. (ISBN: 0672321092)
Taylor, A. David. Object Technology. Boston: Addison-Wesley, 1997. (ISBN: 0201309947)
For more information on PHP's object-oriented capabilities, check out the following:
Atkinson, Leon. Core PHP Programming: Using PHP to Build Dynamic Web Sites. Prentice Hall PTR, 2001. (ISBN: 0130893986)