Monthly Archives: December 2014

Interface vs Abstract class in PHP

Interfaces and Abstract classes are powerful and fundamental concepts in OOP, but there’s an awful lot of confusion about what these do and why you should use each.

We will examine why an abstract class is good when you want to specify some implementation details, and how an interface is good when you can’t generically describe any of the implementation details but you know what the functions should be named and what their signatures should look like.

Let’s take a look at why these should be utilized with some simple analogies and code examples.

Continue reading Interface vs Abstract class in PHP