Menu
Samaritan's Purse

IS_SUBCLASS_OF

Checks if the object has this class as one of its parents or implements it

SYNTAX

is_subclass_of ( mixed $object , string $class_name [, bool $allow_string = TRUE ] ) : bool

PARAMETERS

object

A class name or an object instance. No error is generated if the class does not exist.

class_name

The class name

allow_string

If this parameter set to false, string class name as object is not allowed. This also prevents from calling autoloader if the class doesn't exist.

RETURN

This function returns TRUE if the object object, belongs to a class which is a subclass of class_name, FALSE otherwise.

EXAMPLES

OBJECT CLASS_NAME

true

ALLOW_STRING | FALSE

false

ALLOW_STRING | TRUE

true

NAMESPACE

true

INTERFACE

true

PHP