PHP 7.0.7 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

add a note add a note

User Contributed Notes 1 note

up
1
dhairya dot coder at gmail dot com
3 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