PHP 7.0.6 Released

ReflectionClass::isSubclassOf

(PHP 5, PHP 7)

ReflectionClass::isSubclassOfChecks if a subclass

Description

public bool ReflectionClass::isSubclassOf ( string $class )

Checks if the class is a subclass of a specified class or implements a specified interface.

Parameters

class

The class name being checked against.

Return Values

Returns TRUE on success or FALSE on failure.

See Also

User Contributed Notes

dhairya lakhera
2 months ago
class A {}
class B {}
class C extends B {}

$obj=new ReflectionClass('C');

var_dump($obj->isSubclassOf ('A')); //boolean false
var_dump($obj->isSubclassOf ('B')); //boolean true
To Top