3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo {} class Bar extends Foo {} class Baz extends Bar {} $object = new Baz(); $tree = array(); $class = get_class($object); do { $tree[] = $class; } while ($class = get_parent_class($class)); var_dump($tree);
based on K4nq1
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(3) { [0]=> string(3) "Baz" [1]=> string(3) "Bar" [2]=> string(3) "Foo" }
Output for 4.3.0 - 4.4.9
array(3) { [0]=> string(3) "baz" [1]=> string(3) "bar" [2]=> string(3) "foo" }