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.3.5 - 8.3.31, 8.4.9 - 8.4.22, 8.5.6 - 8.5.7
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:
56.57 ms | 524 KiB | 4 Q