3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Test { private $x; private $y; private $z; public function __constructor() { $this->x = 100; $this->y = 20; $this->z = 30; } public function _get($k) { echo $this->x; return $this->$k; } } $t = new Test(); echo $t->x . PHP_EOL;
based on PNP7T
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Cannot access private property Test::$x in /in/RaL93:24 Stack trace: #0 {main} thrown in /in/RaL93 on line 24
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Fatal error: Cannot access private property Test::$x in /in/RaL93 on line 24
Process exited with code 255.