(PHP 5, PHP 7, PHP 8)
ReflectionClass::getParentClass — Gets parent class
This function has no parameters.
A ReflectionClass or false
if there's no parent.
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);