3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Test { public $publicProperty; protected $protectedProperty; private $privateProperty; public function __construct() { unset( $this->publicProperty, $this->protectedProperty, $this->privateProperty ); } function __get($name) { echo '__get ' . $name . "\n"; return $this->$name; } function __set($name, $value) { echo '__set ' . $name . "\n"; $this->$name = $value; } function __isset($name) { echo '__isset ' . $name . "\n"; return isset($this->$name); } } $test = new Test(); $test->nonExisting; $test->publicProperty; $test->protectedProperty; $test->privateProperty; isset($test->nonExisting); isset($test->publicProperty); isset($test->protectedProperty); isset($test->privateProperty); $test->nonExisting = 'value'; $test->publicProperty = 'value'; $test->protectedProperty = 'value'; $test->privateProperty = 'value'; ?> --EXPECTF-- __get nonExisting Notice: Undefined index: nonExisting in %__set__get_006.php on line %d __get publicProperty Notice: Undefined index: publicProperty in %__set__get_006.php on line %d __get protectedProperty Notice: Undefined index: protectedProperty in %__set__get_006.php on line %d __get privateProperty Notice: Undefined index: protectedProperty in %__set__get_006.php on line %d __isset nonExisting __isset publicProperty __isset protectedProperty __isset privateProperty __set nonExisting __set publicProperty __set protectedProperty __set privateProperty
Output for 5.3.22 - 5.3.29, 5.4.12 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
__get nonExisting Notice: Undefined property: Test::$nonExisting in /in/XWAgg on line 17 __get publicProperty Notice: Undefined property: Test::$publicProperty in /in/XWAgg on line 17 __get protectedProperty Notice: Undefined property: Test::$protectedProperty in /in/XWAgg on line 17 __get privateProperty Notice: Undefined property: Test::$privateProperty in /in/XWAgg on line 17 __isset nonExisting __isset publicProperty __isset protectedProperty __isset privateProperty __set nonExisting __set publicProperty __set protectedProperty __set privateProperty --EXPECTF-- __get nonExisting Notice: Undefined index: nonExisting in %__set__get_006.php on line %d __get publicProperty Notice: Undefined index: publicProperty in %__set__get_006.php on line %d __get protectedProperty Notice: Undefined index: protectedProperty in %__set__get_006.php on line %d __get privateProperty Notice: Undefined index: protectedProperty in %__set__get_006.php on line %d __isset nonExisting __isset publicProperty __isset protectedProperty __isset privateProperty __set nonExisting __set publicProperty __set protectedProperty __set privateProperty
Output for 5.2.6 - 5.3.21, 5.4.0 - 5.4.11
__get nonExisting Notice: Undefined property: Test::$nonExisting in /in/XWAgg on line 17 __get publicProperty Notice: Undefined property: Test::$publicProperty in /in/XWAgg on line 17 __get protectedProperty __get protectedProperty Notice: Undefined property: Test::$protectedProperty in /in/XWAgg on line 17 __get privateProperty __get privateProperty Notice: Undefined property: Test::$privateProperty in /in/XWAgg on line 17 __isset nonExisting __isset publicProperty __isset protectedProperty __isset protectedProperty __isset privateProperty __isset privateProperty __set nonExisting __set publicProperty __set protectedProperty __set protectedProperty __set privateProperty __set privateProperty --EXPECTF-- __get nonExisting Notice: Undefined index: nonExisting in %__set__get_006.php on line %d __get publicProperty Notice: Undefined index: publicProperty in %__set__get_006.php on line %d __get protectedProperty Notice: Undefined index: protectedProperty in %__set__get_006.php on line %d __get privateProperty Notice: Undefined index: protectedProperty in %__set__get_006.php on line %d __isset nonExisting __isset publicProperty __isset protectedProperty __isset privateProperty __set nonExisting __set publicProperty __set protectedProperty __set privateProperty
Output for 5.1.0 - 5.2.5
__get nonExisting Notice: Undefined property: Test::$nonExisting in /in/XWAgg on line 17 __get publicProperty Notice: Undefined property: Test::$publicProperty in /in/XWAgg on line 17 __get protectedProperty __get protectedProperty Notice: Undefined property: Test::$protectedProperty in /in/XWAgg on line 17 __get privateProperty __get privateProperty Notice: Undefined property: Test::$privateProperty in /in/XWAgg on line 17 __isset nonExisting __isset publicProperty __isset protectedProperty __isset protectedProperty __isset privateProperty __isset privateProperty __set nonExisting __set publicProperty __set protectedProperty __set protectedProperty __set privateProperty __set privateProperty --EXPECTF-- __get nonExisting Notice: Undefined index: nonExisting in %__set__get_006.php on line %d __get publicProperty Notice: Undefined index: publicProperty in %__set__get_006.php on line %d __get protectedProperty Notice: Undefined index: protectedProperty in %__set__get_006.php on line %d __get privateProperty Notice: Undefined index: protectedProperty in %__set__get_006.php on line %d __isset nonExisting __isset publicProperty __isset protectedProperty __isset privateProperty __set nonExisting __set publicProperty __set protectedProperty __set privateProperty
Output for 5.0.0 - 5.0.5
__get nonExisting Notice: Undefined property: Test::$nonExisting in /in/XWAgg on line 17 __get publicProperty Notice: Undefined property: Test::$publicProperty in /in/XWAgg on line 17 Fatal error: Cannot access protected property Test::$protectedProperty in /in/XWAgg on line 35
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/XWAgg on line 3
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/XWAgg on line 3
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/XWAgg on line 3
Process exited with code 255.