3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait T { protected int $x; } class A { use T; } class B { use T; public function writeToA(A $a): void { $a->x = 1; } } (new B)->writeToA(new A);
Output for git.master_jit, git.master
Fatal error: Uncaught Error: Cannot access protected property A::$x in /in/hM5TM:16 Stack trace: #0 /in/hM5TM(20): B->writeToA(Object(A)) #1 {main} thrown in /in/hM5TM 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:
47.72 ms | 405 KiB | 5 Q