3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait A { public function foo() { echo "foo"; } } trait B { use A { foo as foobar; } public function foo() { foobar(); echo "bar"; } } class AB { use A; public function run() { $this->foo(); } } class ABC { use B; } $me = new ABC(); $me->run();
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined method ABC::run() in /in/qtB81:24 Stack trace: #0 {main} thrown in /in/qtB81 on line 24
Process exited with code 255.
Output for 5.4.0 - 5.4.10, 5.4.13 - 5.6.28
Fatal error: Call to undefined method ABC::run() in /in/qtB81 on line 24
Process exited with code 255.
Output for 5.4.11 - 5.4.12
Fatal error: Trait method foo has not been applied, because there are collisions with other trait methods on ABC in /in/qtB81 on line 21
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/qtB81 on line 3
Process exited with code 255.