3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = new stdClass(); $a->{1} = 'Y'; $x = unserialize(serialize($a)); $prop = 1; var_dump($x->$prop); $r = new ReflectionObject($x); var_dump($r->getProperties());
Output for 7.0.0 - 7.1.0
string(1) "Y" array(1) { [0]=> object(ReflectionProperty)#4 (2) { ["name"]=> string(1) "1" ["class"]=> string(8) "stdClass" } }
Output for 5.2.0 - 5.2.5, 5.3.9 - 5.6.28
string(1) "Y" array(1) { [0]=> &object(ReflectionProperty)#4 (2) { ["name"]=> string(1) "1" ["class"]=> string(8) "stdClass" } }
Output for 5.2.6 - 5.3.8
Notice: Undefined property: stdClass::$1 in /in/4GIAE on line 6 NULL array(0) { }
Output for 5.0.0 - 5.1.6
string(1) "Y" array(0) { }
Output for 4.3.3 - 4.4.9
Fatal error: Property name must be a string in /in/4GIAE on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.2

Process exited with code 139.