Sunday, 28 September 2014

Object Oriented Programming in PHP : Interfaces

Interfaces are defined to provide a common function names to the implementors. Different implementors can implement those interfaces according to theri requirements. You can say, interfaces are skeltons which are implemented by developers.



As of PHP5, it is possible to define an interface, like this:
interface Mail {
   public function sendMail();
}
Then, if another class implemented that interface, like this:
class Report implements Mail {
   // sendMail() Definition goes here
} 
 
 
 

No comments:

Post a Comment