Implements

We use implements keyword to extend interface of class, at the same time we can implement more than one interface and one interface can be implemented by another interface.

All methods declared in an interface must be public and the variables should be constant.

This is mandatory that we must declare the body part of the method in the derived class otherwise an error message will be generated.

Example

<?php
interface a{
public function test();
}

class b implements a{
public function test(){
echo “Function Test”;
}
}

$b=new b();
$b->test();
?>

Share