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) { echo $properties[0]->getValue($a) . PHP_EOL; }
based on E77cH
Output for 7.4.0
0
Output for 7.0.7 - 7.3.12
1 Notice: Undefined property: A::$test in /in/Y2CkO on line 16
Output for 5.6.0 - 7.0.6
1