3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $foo; } class Bar extends Foo { public $bar; } $barClassReflection = new ReflectionClass(Bar::class); $properties = $barClassReflection->getProperties(); var_dump($properties); foreach ($properties as $property) { var_dump($property->getName()); var_dump($property->class); var_dump($property->getDeclaringClass()->getName()); var_dump($property->class === $property->getDeclaringClass()->getName()); }
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> object(ReflectionProperty)#2 (2) { ["name"]=> string(3) "bar" ["class"]=> string(3) "Bar" } [1]=> object(ReflectionProperty)#3 (2) { ["name"]=> string(3) "foo" ["class"]=> string(3) "Foo" } } string(3) "bar" string(3) "Bar" string(3) "Bar" bool(true) string(3) "foo" string(3) "Foo" string(3) "Foo" bool(true)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
73.06 ms | 402 KiB | 8 Q