PHP 5.4 – Code reuse using Traits

Traits enables a developer to reuse sets of methods freely in several independent classes living in different class hierarchies. PHP being a single inheritance language, traits enables horizontal composition of behavior – the application of class members without requiring inheritance. Continue reading PHP 5.4 – Code reuse using Traits

PHP 5.4 – Traits, Closures, and Prototype-based Programming

According to Wikipedia, prototype-based programming is “a style of object-oriented programming in which classes are not present, and behavior reuse (known as inheritance in class-based languages) is performed via a process of cloning existing objects that serve as prototypes”With magic Continue reading PHP 5.4 – Traits, Closures, and Prototype-based Programming