3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { public $oink = 'foo'; } $foo = new Foo; class Bar extends Foo { public function __construct() { var_dump( get_object_vars($this), get_class($this), get_parent_class($this), $r = new ReflectionProperty($this, 'oink'), $r->getValue($this), $p = new ReflectionProperty(get_parent_class($this), 'oink'), $p->getValue($this) ); unset($this->oink); var_dump( get_object_vars($this), get_class($this), get_parent_class($this), $r = new ReflectionProperty($this, 'oink'), $r->getValue($this), $p = new ReflectionProperty(get_parent_class($this), 'oink'), $p->getValue($this) ); $this->oink = 'bar'; var_dump( get_object_vars($this), get_class($this), get_parent_class($this), $r = new ReflectionProperty($this, 'oink'), $r->getValue($this), $p = new ReflectionProperty(get_parent_class($this), 'oink'), $p->getValue($this) ); } } $bar = new Bar;
Output for 7.0.7 - 7.1.0
array(1) { ["oink"]=> string(3) "foo" } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#3 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "foo" object(ReflectionProperty)#4 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "foo" Notice: Undefined property: Bar::$oink in /in/LbFki on line 32 Notice: Undefined property: Bar::$oink in /in/LbFki on line 34 array(0) { } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#5 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } NULL object(ReflectionProperty)#3 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } NULL array(1) { ["oink"]=> string(3) "bar" } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#4 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "bar" object(ReflectionProperty)#5 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "bar"
Output for 5.2.10 - 5.6.28, 7.0.0 - 7.0.6
array(1) { ["oink"]=> string(3) "foo" } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#3 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "foo" object(ReflectionProperty)#4 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "foo" array(0) { } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#5 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } NULL object(ReflectionProperty)#3 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } NULL array(1) { ["oink"]=> string(3) "bar" } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#4 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "bar" object(ReflectionProperty)#5 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "bar"
Output for hhvm-3.12.0
Fatal error: Uncaught TypeError: Argument 2 passed to hphp_get_property() must be an instance of string, null given in /in/LbFki:23 Stack trace: #0 /in/LbFki(23): ReflectionProperty->getValue() #1 /in/LbFki(52): Bar->__construct() #2 {main}
Process exited with code 255.
Output for hhvm-3.10.0
array(1) { ["oink"]=> string(3) "foo" } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#3 (4) { ["info"]=> array(9) { ["name"]=> string(4) "oink" ["default"]=> bool(true) ["defaultValue"]=> string(3) "foo" ["access"]=> string(6) "public" ["accessible"]=> bool(true) ["modifiers"]=> int(256) ["class"]=> string(3) "Foo" ["doc"]=> bool(false) ["type"]=> bool(false) } ["name"]=> string(4) "oink" ["class"]=> string(3) "Bar" ["forceAccessible":"ReflectionProperty":private]=> bool(false) } string(3) "foo" object(ReflectionProperty)#4 (4) { ["info"]=> array(9) { ["name"]=> string(4) "oink" ["default"]=> bool(true) ["defaultValue"]=> string(3) "foo" ["access"]=> string(6) "public" ["accessible"]=> bool(true) ["modifiers"]=> int(256) ["class"]=> string(3) "Foo" ["doc"]=> bool(false) ["type"]=> bool(false) } ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" ["forceAccessible":"ReflectionProperty":private]=> bool(false) } string(3) "foo" array(0) { } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#5 (4) { ["info"]=> array(9) { ["name"]=> string(4) "oink" ["default"]=> bool(true) ["defaultValue"]=> string(3) "foo" ["access"]=> string(6) "public" ["accessible"]=> bool(true) ["modifiers"]=> int(256) ["class"]=> string(3) "Foo" ["doc"]=> bool(false) ["type"]=> bool(false) } ["name"]=> string(4) "oink" ["class"]=> string(3) "Bar" ["forceAccessible":"ReflectionProperty":private]=> bool(false) } NULL object(ReflectionProperty)#6 (4) { ["info"]=> array(9) { ["name"]=> string(4) "oink" ["default"]=> bool(true) ["defaultValue"]=> string(3) "foo" ["access"]=> string(6) "public" ["accessible"]=> bool(true) ["modifiers"]=> int(256) ["class"]=> string(3) "Foo" ["doc"]=> bool(false) ["type"]=> bool(false) } ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" ["forceAccessible":"ReflectionProperty":private]=> bool(false) } NULL array(1) { ["oink"]=> string(3) "bar" } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#7 (4) { ["info"]=> array(9) { ["name"]=> string(4) "oink" ["default"]=> bool(true) ["defaultValue"]=> string(3) "foo" ["access"]=> string(6) "public" ["accessible"]=> bool(true) ["modifiers"]=> int(256) ["class"]=> string(3) "Foo" ["doc"]=> bool(false) ["type"]=> bool(false) } ["name"]=> string(4) "oink" ["class"]=> string(3) "Bar" ["forceAccessible":"ReflectionProperty":private]=> bool(false) } string(3) "bar" object(ReflectionProperty)#8 (4) { ["info"]=> array(9) { ["name"]=> string(4) "oink" ["default"]=> bool(true) ["defaultValue"]=> string(3) "foo" ["access"]=> string(6) "public" ["accessible"]=> bool(true) ["modifiers"]=> int(256) ["class"]=> string(3) "Foo" ["doc"]=> bool(false) ["type"]=> bool(false) } ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" ["forceAccessible":"ReflectionProperty":private]=> bool(false) } string(3) "bar"
Output for 5.2.0 - 5.2.9
array(1) { ["oink"]=> string(3) "foo" } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#3 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Bar" } string(3) "foo" object(ReflectionProperty)#4 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "foo" array(0) { } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#5 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Bar" } NULL object(ReflectionProperty)#3 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } NULL array(1) { ["oink"]=> string(3) "bar" } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#4 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Bar" } string(3) "bar" object(ReflectionProperty)#5 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "bar"
Output for 5.1.3 - 5.1.6
array(1) { ["oink"]=> string(3) "foo" } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#3 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Bar" } string(3) "foo" object(ReflectionProperty)#4 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "foo" Fatal error: Internal error: Could not find the property oink in /in/LbFki on line 32
Process exited with code 255.
Output for 5.0.3 - 5.1.2
array(1) { ["oink"]=> string(3) "foo" } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#3 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "foo" object(ReflectionProperty)#4 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "foo" Fatal error: Internal error: Could not find the property oink in /in/LbFki on line 32
Process exited with code 255.
Output for 5.0.0 - 5.0.2
array(1) { ["oink"]=> string(3) "foo" } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#3 (2) { ["class"]=> string(3) "Foo" ["name"]=> string(4) "oink" } string(3) "foo" object(ReflectionProperty)#4 (2) { ["class"]=> string(3) "Foo" ["name"]=> string(4) "oink" } string(3) "foo" Fatal error: Internal error: Could not find the property oink in /in/LbFki on line 32
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/LbFki on line 6
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/LbFki on line 6
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/LbFki on line 6
Process exited with code 255.