3v4l.org

run code in 200+ PHP versions simultaneously
<?php class A extends \ArrayObject {} $a = new A; $a->offsetSet('test', 'testValue'); $reflection = new \ReflectionObject($a); $properties = $reflection->getProperties(); $c = count($properties); echo $c . PHP_EOL; if ($c) { var_dump($properties[0]->getValue($a)); }
based on Y2CkO
Output for 7.4.0
0
Output for 7.0.7 - 7.3.1
1 Notice: Undefined property: A::$test in /in/UcTHf on line 16 NULL
Output for 5.3.0 - 7.0.6
1 NULL
Output for 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UcTHf on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UcTHf on line 8 1 NULL
Output for 5.0.2 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UcTHf on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UcTHf on line 8 0
Output for 5.0.0 - 5.0.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UcTHf on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UcTHf on line 8 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/UcTHf on line 13 0PHP_EOL
Output for 4.3.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UcTHf on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UcTHf on line 8 Fatal error: Class a: Cannot inherit from undefined class arrayobject in /in/UcTHf on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UcTHf on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UcTHf on line 8 Fatal error: Class a: Cannot inherit from undefined class arrayobject in /in/UcTHf on line 3