class_parents

(PHP 5)

class_parents --  Return the parent classes of the given class

Leírás

array class_parents ( mixed class [, bool autoload] )

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

Paraméterek

class

An object or a string of the class

Visszatérési értékek

Returns an array or FALSE on error.

Változások naplója

VáltozatLeírás
5.1.0 Added the option to pass the parameter as a string

Példák

Példa 1. class_parents() example

<?php

class foo { }
class
bar extends foo {}

print_r(class_parents(new bar));

?>

A fenti példa a következő kimenetet adja:

Array
(
    [foo] => foo
)

Lásd még

class_implements()