PHP 5.6.22 is available

ReflectionClass::implementsInterface

(PHP 5)

ReflectionClass::implementsInterfaceImplements interface

Descrizione

public bool ReflectionClass::implementsInterface ( string $interface )

Checks whether it implements an interface.

Elenco dei parametri

interface

The interface name.

Valori restituiti

Restituisce TRUE in caso di successo, FALSE in caso di fallimento.

Vedere anche:

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