3v4l.org

run code in 300+ PHP versions simultaneously
<?php class PHPFI { public $a = 'A PROPERTY'; protected $b = 'B PROPERTY'; private $c = 'C PROPERTY'; } $phpfi = new PHPFI(); var_dump((array) $phpfi); // array(3) { // ["a"]=> // string(10) "A PROPERTY" // ["*b"]=> // string(10) "B PROPERTY" // ["PHPFIc"]=> // string(10) "C PROPERTY" // } $reflect = new ReflectionClass($phpfi); $reflectProps = $reflect->getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED | ReflectionProperty::IS_PRIVATE); $props = []; foreach ($reflectProps as $prop) { switch (true) { case $prop->isProtected(): $prefix = '*'; break; case $prop->isPrivate(): $prefix = $prop->getDeclaringClass()->getName(); break; default: $prefix = ''; break; } $prop->setAccessible(true); $props[$prefix . $prop->getName()] = $prop->getValue($phpfi); } var_dump($props); // array(3) { // ["a"]=> // string(10) "A PROPERTY" // ["*b"]=> // string(10) "B PROPERTY" // ["PHPFIc"]=> // string(10) "C PROPERTY" // }
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { ["a"]=> string(10) "A PROPERTY" ["*b"]=> string(10) "B PROPERTY" ["PHPFIc"]=> string(10) "C PROPERTY" } array(3) { ["a"]=> string(10) "A PROPERTY" ["*b"]=> string(10) "B PROPERTY" ["PHPFIc"]=> string(10) "C PROPERTY" }

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:
59.91 ms | 401 KiB | 8 Q