is_subclass_of

bool is_subclass_of(object obj, string parent_class_name) 
obj Object to test for being a subclass of parent_class_name
parent_class_name Name of the class to test with

Finds whether an object’s class is a subclass of a given class.

Returns:

TRUE if the given object is a subclass of the given class; FALSE for all other cases

Description:

is_subclass_of() is used to determine whether the class from which a given object is instantiated is a subclass of the given class.

Availability:

UNIX, Windows

Version:

4.0b4+

See also:

get_parent_class() 

Example:

Determine whether a class is a subclass of another class
 class vehicle { var $passenger_num; var $power_source; var $travel_medium; } class jinrikisha extends vehicle { var $wheels ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.