3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A {} $a = new A; $a->foo = "dynamic property"; $ro = new ReflectionObject($a); $prop = $ro->getProperty('foo'); try { var_dump($prop->getValue($a)); var_dump($prop->getValue(new A)); } catch (ReflectionException $ex) { echo "Caught!\n"; try { var_dump($prop->getValue(new A)); } catch (ReflectionException $ex) { var_dump($ex->getMessage()); } }
Output for 7.0.14 - 7.1.0
string(16) "dynamic property" Notice: Undefined property: A::$foo in /in/PHAvK on line 10 NULL
Output for 5.3.4 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.0.6
string(16) "dynamic property" NULL
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.3.0 - 5.3.3
NULL NULL
Output for 5.2.7 - 5.2.17
Fatal error: Cannot access property started with '\0' in /in/PHAvK on line 9
Process exited with code 255.
Output for 5.0.5 - 5.2.6
Fatal error: Uncaught exception 'ReflectionException' with message 'Property foo does not exist' in /in/PHAvK:7 Stack trace: #0 /in/PHAvK(7): ReflectionClass->getProperty('foo') #1 {main} thrown in /in/PHAvK on line 7
Process exited with code 255.
Output for 5.0.3 - 5.0.4
Fatal error: Uncaught exception 'ReflectionException' with message 'Property foo does not exist' in /in/PHAvK:7 Stack trace: #0 /in/PHAvK(7): ReflectionObject->getProperty('foo') #1 {main} thrown in /in/PHAvK on line 7
Process exited with code 255.
Output for 5.0.1 - 5.0.2
Fatal error: Uncaught exception 'ReflectionException' with message 'Property foo does not exist' in /in/PHAvK:7 Stack trace: #0 {main} thrown in /in/PHAvK on line 7
Process exited with code 255.
Output for 5.0.0
Fatal error: Call to a member function getValue() on a non-object in /in/PHAvK on line 9
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '{' in /in/PHAvK on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '{' in /in/PHAvK on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/PHAvK on line 8
Process exited with code 255.