The Factory Pattern in PHP 5

-

Introduction

The factory is one of the most common OOP patterns. The concept of the factory pattern is pretty straight forward. The factory pattern uses a class that has methods that create objects rather than creating the objects directly.

Example Factory Pattern

Instead of just instantiating the class directly below:

You would make another class (this is where the factory part comes in):

you would use the above class by:

Comments

Visitor stats.