class_parents

(PHP 5)

class_parents --  Return the parent classes of the given class

说明

array class_parents ( mixed class )

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

参数

class

An object or a string of the class

返回值

Returns an array or FALSE on error.

更新日志

版本说明
5.1.0 Added the option to pass the parameter as a string

例子 1. class_parents() example

<?php

class foo { }
class
bar extends foo {}

print_r(class_parents(new bar));

?>

上例将输出:

Array
(
    [foo] => foo
)

参见

class_implements()