3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Bar { public $baseFoo = 1; protected $baseBar = 2; } class Foo extends Bar { public $foo = 3; protected $bar = 4; } $foo = new Foo(); $reflect = new ReflectionClass('Foo'); $props = array_filter( $reflect->getProperties(), function($prop){ return $prop->getDeclaringClass()->getName() === Foo::class; }); foreach ($props as $prop) { print $prop->getName() . "\n"; }
based on TPtvm
Output for 5.6.0 - 7.3.0beta1
foo bar