ConFoo Montreal 2017 Calling for Papers

ReflectionClass::implementsInterface

(PHP 5, PHP 7)

ReflectionClass::implementsInterfaceImplements interface

Descrição

public bool ReflectionClass::implementsInterface ( string $interface )

Checks whether it implements an interface.

Parâmetros

interface

The interface name.

Valor Retornado

Retorna TRUE em caso de sucesso ou FALSE em caso de falha.

Veja Também

add a note add a note

User Contributed Notes 1 note

up
0
dhairya dot coder at gmail dot com
6 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