3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait TraitA { public function methodA() { var_dump(__METHOD__); } public function methodB() { var_dump(__METHOD__); } } class ClassA { use TraitA { methodA as private traitMethodA; methodB as private traitMethodB; } public function methodA() { var_dump(__METHOD__); $this->traitMethodA(); } } $o = new ClassA(); $o->methodA(); $o->methodB(); $o->traitMethodB();
Output for git.master, git.master_jit, rfc.property-hooks
string(15) "ClassA::methodA" string(15) "TraitA::methodA" string(15) "TraitA::methodB" Fatal error: Uncaught Error: Call to private method ClassA::traitMethodB() from global scope in /in/EmNhJ:27 Stack trace: #0 {main} thrown in /in/EmNhJ on line 27
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:
43.71 ms | 401 KiB | 8 Q