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.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
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:
27.29 ms | 1152 KiB | 7 Q