PHP 4, PHP 5, PHP 7, PHP 8
get_parent_class - Retrieves the parent class name for object or class
Code Examples

get_parent_class( [object|string$object_or_class] ): string|false

Retrieves the parent class name for object or class.



The tested object or class name. This parameter is optional if called from the object's method.

Return Values

Returns the name of the parent class of the class of which object_or_class is an instance or the name.


If the object does not have a parent or the class given does not exist false will be returned.

If called without parameter outside object, this function returns false.


Version Description
8.0.0 The object_or_class parameter now only accepts objects or valid class names.

Related Functions

Example of get_parent_class

Show all examples for get_parent_class

PHP Version:

Function get_parent_class:

Class/Object Information Functions

Most used PHP functions