3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { private $bar, $baz; } $foo_reflection = new ReflectionObject(new Foo); var_dump( array_map( function (ReflectionProperty $prop) { $visibility = null; switch ($prop->getModifiers()) { case ReflectionProperty::IS_PUBLIC: $visibility = 'public'; break; case ReflectionProperty::IS_PROTECTED: $visibility = 'protected'; break; case ReflectionProperty::IS_PRIVATE: $visibility = 'private'; break; } return [ 'Name' => $prop->getName(), 'Visibility' => $visibility, ]; }, $foo_reflection->getProperties() ) );
based on GO6gp
Output for 5.5.0 - 5.6.38, hhvm-3.11.1 - 3.22.0, 7.0.0 - 7.2.12
array(2) { [0]=> array(2) { ["Name"]=> string(3) "bar" ["Visibility"]=> string(7) "private" } [1]=> array(2) { ["Name"]=> string(3) "baz" ["Visibility"]=> string(7) "private" } }