In previous chapters you have learned what a design pattern is and how you can make best use of them in your PHP development. In this chapter you'll see once again that design patterns are not just academic exercises but can be frequently and effectively deployed in real-word applications. Sometimes well-known patterns emerge without your even realizing it.
This chapter introduces you to the factory interface and sets out not only the situations for which it is most appropriate, but also how you can successfully apply it in your own programs.
To help you get the most out of this chapter, we will introduce some code examples that make use of factory interfaces. We also discuss how those code examples can be improved with the new features of PHP5, taking care to note any important implementation details along the way.