3v4l.org

run code in 200+ 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.2.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 - 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 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.