3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base { protected function func() { echo 1; } public function test() { $this->func(); } } class Child extends Base { private function func() { echo 2; } } $c = new Child(); $c->test();
Output for 5.4.18
Fatal error: Access level to Child::func() must be protected (as in class Base) or weaker in /in/nqJps on line 23
Process exited with code 255.
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.17
Fatal error: Access level to Child::func() must be protected (as in class Base) or weaker in /in/tSEna on line 23
Process exited with code 255.

preferences:
171.83 ms | 1395 KiB | 54 Q