Difference between abstract class and interface in PHP

Abstract class

Abstract class is not directly instantiable, but acts as a common base for children classes.

In abstract class you should mark a class as abstract by placing the abstract keyword before class and must have at least one abstract method.

Interface

Any class that has the Interface must implement all methods listed in the interface.

The class can have multiple interface.

The summary table of differences between abstract classes and interfaces

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">