3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Basic{ public function sayHello(){ echo 'Hello world!'; } } trait TraitMethod{ public function sayHello($name){ echo 'Hello! My name is '.$name; } } class TestA extends Basic{ use TraitMethod; } $objTestA = new TestA(); $objTestA->sayHello("Anna");
based on 0Asks
Output for 7.0.0 - 7.2.0
Warning: Declaration of TraitMethod::sayHello($name) should be compatible with Basic::sayHello() in /in/1LGTn on line 15 Hello! My name is Anna
Output for 5.4.11 - 5.6.28
Strict Standards: Declaration of TraitMethod::sayHello() should be compatible with Basic::sayHello() in /in/1LGTn on line 17 Hello! My name is Anna
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/1LGTn on line 9
Process exited with code 255.