class_parents

(PHP 5)

class_parents --  Return the parent classes of the given class

Description

array class_parents ( mixed class [, bool autoload] )

This function returns an array with the name of the parent classes of the given class.

Parameters

class

An object or a string of the class

Return Values

Returns an array or FALSE on error.

ChangeLog

VersionDescription
5.1.0 Added the option to pass the parameter as a string

Examples

Example 1. class_parents() example

<?php

class foo { }
class
bar extends foo {}

print_r(class_parents(new bar));

?>

The above example will output:

Array
(
    [foo] => foo
)

See Also

class_implements()