ReflectionClass::getParentClass

(PHP 5, PHP 7, PHP 8)

ReflectionClass::getParentClassEbeveyn sınıfı döndürür

Açıklama

public ReflectionClass::getParentClass(): ReflectionClass|false

Ebeveyn sınıfı döndürür.

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

Bir ReflectionClass nesnesi veya ebeveyn sınıf yoksa false döner.

Ayrıca Bakınız

add a note

User Contributed Notes 1 note

up
18
isaac dot z dot foster at gmail dot com
11 years ago
To find all parents of a class you can use the following code:

$class = new ReflectionClass('classname');

$parents = [];

while ($parent = $class->getParentClass()) {
$parents[] = $parent->getName();
$class = $parent;
}

echo "Parents: " . implode(", ", $parents);
To Top