sample code for several design patterns in PHP