3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class A { abstract protected function test(); } class C extends A { protected function test() { return 'C'; } } class D extends A { public function prnt(A $a) { echo $a->test(); } protected function test() { return 'D'; } } $d = new D; $c = new C; $d->prnt($d); $d->prnt($c); trait E { protected function test() { return 'E'; } } class B extends A { use E; } $b = new B; $d->prnt($b);
Output for rfc.property-hooks, git.master, git.master_jit
DC Fatal error: Uncaught Error: Call to protected method B::test() from scope D in /in/TPTS9:16 Stack trace: #0 /in/TPTS9(44): D->prnt(Object(B)) #1 {main} thrown in /in/TPTS9 on line 16
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
51.8 ms | 999 KiB | 4 Q