PHP 7.0.6 Released

ReflectionClass::implementsInterface

(PHP 5, PHP 7)

ReflectionClass::implementsInterfaceImplements interface

Description

public bool ReflectionClass::implementsInterface ( string $interface )

Checks whether it implements an interface.

Parameters

interface

The interface name.

Return Values

Returns TRUE on success or FALSE on failure.

See Also

User Contributed Notes

dhairya dot coder at gmail dot com
2 months ago
//checks that whether class Fruit implements interface apple or not

interface Apple {
   
    function taste();
}

class Fruit implements Apple {
   
    function taste() {
        echo "Seet";
    }
}

$obj=new ReflectionClass('Fruit');
var_dump($obj->implementsInterface('Apple'));  //Here it will checks that whether class Fruit implements interface apple or not
To Top