Quick correction, the code for getting all parent classes below has a "typo", you need to reset the $class variable to the parent class instance, otherwise it just endlessly loops:
$class = new ReflectionClass('classname');
$parents = array();
while ($parent = $class->getParentClass()) {
$parents[] = $parent->getName();
$class = $parent;
}
echo "Parents: " . implode(", ", $parents);