PHP program to implement multiple-inheritance using the interface

bookmark

<?php
//PHP program to implement multiple-inheritance 
//using the interface.
class Base
{
    public function Fun1()
    {
        printf("Fun1() called<br>");
    }
}

interface Inf
{
    public function Fun2();
}

class Derived extends Base implements Inf
{
    function Fun2()
    {
        printf("Fun2() called<br>");
    }

    function Fun3()
    {
        printf("Fun3() called<br>");
    }
}

$obj = new Derived();

$obj->Fun1();
$obj->Fun2();
$obj->Fun3();

?>


Output
Fun1() called
Fun2() called
Fun3() called