3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Base { private $_e; protected function setE() { $this->$_e++; } protected 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();
based on Yt5JF
Output for 7.0.0 - 7.2.8
Fatal error: Uncaught Error: Call to protected method Base::getE() from context '' in /in/0gfHJ:37 Stack trace: #0 {main} thrown in /in/0gfHJ on line 37
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Fatal error: Call to protected method Base::getE() from context '' in /in/0gfHJ on line 37
Process exited with code 255.