3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public $a = 3; protected $b = 4; private $c = 5; } class B extends A { public $a = 9; private $b = 8; private $c = 7; function doIt() { return $this->a + $this->b + $this->c; } } $b = new B(); echo $b->doIt();
based on 1DOXW
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.1.7
Fatal error: Access level to B::$b must be protected (as in class A) or weaker in /in/DT2R1 on line 18
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: Access level to B::$b() must be protected (as in class A) or weaker in /in/DT2R1:11 Stack trace: #0 {main}
Process exited with code 255.