Difference between Interface and Abstract class (particularly in PHP)


I have a doubt that eats my head and I searched in San Google but I find only technical answers and they do not help me much.

I would like you to be able to tell me in a simple and clear way (if you will) the difference between an interface and an abstract class, more precisely in PHP.

asked by elGoye 23.06.2016 в 07:54

1 answer


Think of an interface as a contract. The interface defines what must be done (the functions to be implemented) but does not define how it should be done (how they should be implemented). The abstract classes, on the other hand, are classes that have defined attributes and functions (the what and the how) but that in turn can only define what should be done (the what), known as abstract functions.

answered by 23.06.2016 / 07:58