3v4l.org

run code in 500+ PHP versions simultaneously
<?php abstract class A { private function foo() { print __CLASS__; } } abstract class B extends A { public function foo() { print __CLASS__; } } class C extends B { public function foo() { print __CLASS__; } public function goo() { parent::foo(); a::foo(); } } ($c = new C)->foo(); $c->goo();
Output for 8.2.31 - 8.2.32, 8.3.5 - 8.3.32, 8.4.9 - 8.4.23, 8.5.6 - 8.5.8
CB Fatal error: Uncaught Error: Call to private method A::foo() from scope C in /in/pXCpG:22 Stack trace: #0 /in/pXCpG(27): C->goo() #1 {main} thrown in /in/pXCpG on line 22
Process exited with code 255.

preferences:
51.58 ms | 540 KiB | 4 Q