3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base { private $_e; protected function setE() { $this->$_e++; } public function getE() { return $this->$_e; } } class Foo extends Base { public function __contruct() { $this->setE(); } } class Bar extends Base { public function __contruct() { $this->setE(); } } $foo = new Foo; //$bar = new Bar; echo $foo->getE();
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Undefined variable $_e in /in/KO6G6 on line 14 Warning: Undefined property: Foo::$ in /in/KO6G6 on line 14
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: _e in /in/KO6G6 on line 14 Notice: Undefined property: Foo::$ in /in/KO6G6 on line 14
Output for 7.3.32 - 7.3.33
Output for 7.0.0 - 7.0.33
Notice: Undefined variable: _e in /in/KO6G6 on line 14 Fatal error: Uncaught Error: Cannot access empty property in /in/KO6G6:14 Stack trace: #0 /in/KO6G6(37): Base->getE() #1 {main} thrown in /in/KO6G6 on line 14
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Notice: Undefined variable: _e in /in/KO6G6 on line 14 Fatal error: Cannot access empty property in /in/KO6G6 on line 14
Process exited with code 255.

preferences:
239.96 ms | 402 KiB | 376 Q