3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class PhpClassWithPropertyDefaults { public $propertyWithoutDefault; public $propertyWithNullDefault = null; public $propertyWithTrueDefault = true; } $class = new ReflectionClass('PhpClassWithPropertyDefaults'); $defaults = $class->getDefaultProperties(); var_dump($defaults[0]->name, $defaults[0]->getValue()); var_dump($defaults[1]->name, $defaults[1]->getValue()); var_dump($defaults[2]->name, $defaults[2]->getValue());
Output for 7.0.0 - 7.1.0
Notice: Undefined offset: 0 in /in/7koit on line 13 Notice: Trying to get property of non-object in /in/7koit on line 13 Notice: Undefined offset: 0 in /in/7koit on line 13 Fatal error: Uncaught Error: Call to a member function getValue() on null in /in/7koit:13 Stack trace: #0 {main} thrown in /in/7koit on line 13
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Notice: Undefined offset: 0 in /in/7koit on line 13 Notice: Trying to get property of non-object in /in/7koit on line 13 Notice: Undefined offset: 0 in /in/7koit on line 13 Fatal error: Call to a member function getValue() on null in /in/7koit on line 13
Process exited with code 255.
Output for 5.3.0 - 5.5.35
Notice: Undefined offset: 0 in /in/7koit on line 13 Notice: Trying to get property of non-object in /in/7koit on line 13 Notice: Undefined offset: 0 in /in/7koit on line 13 Fatal error: Call to a member function getValue() on a non-object in /in/7koit on line 13
Process exited with code 255.
Output for 5.0.0 - 5.2.17
Notice: Undefined offset: 0 in /in/7koit on line 13 Notice: Trying to get property of non-object in /in/7koit on line 13 Notice: Undefined offset: 0 in /in/7koit on line 13 Fatal error: Call to a member function getValue() on a non-object in /in/7koit on line 13
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/7koit on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/7koit on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/7koit on line 4
Process exited with code 255.