class_parents

(PHP 5)

class_parents --  Return the parent classes of the given class

Beskrivelse

array class_parents ( mixed class [, bool autoload] )

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

Parameterliste

class

An object or a string of the class

Returneringsværdier

Returns an array or FALSE on error.

ChangeLog

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

Eksempler

Eksempel 1. class_parents() example

<?php

class foo { }
class
bar extends foo {}

print_r(class_parents(new bar));

?>

Ovenstående eksempel vil udskrive:

Array
(
    [foo] => foo
)

Se også

class_implements()