3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Basic{ public function sayHello($name){ echo 'Hello world! I am '.$name; } } trait TraitMethod{ public function sayHello($name){ echo 'Hello! My name is '.$name; } } class TestC extends Basic{ use TraitMethod; public function sayHello($name){ parent::sayHello($name); TraitMethod::sayHello($name); } } $objTestC = new TestC(); $objTestC->sayHello("Anna");
based on p7T7Q
Output for 7.0.0 - 7.2.0
Hello world! I am Anna Deprecated: Non-static method TraitMethod::sayHello() should not be called statically in /in/KPVBC on line 20 Hello! My name is Anna
Output for 5.6.8 - 5.6.28
Hello world! I am Anna Deprecated: Non-static method TraitMethod::sayHello() should not be called statically, assuming $this from incompatible context in /in/KPVBC on line 20 Hello! My name is Anna
Output for 5.4.11 - 5.5.35
Hello world! I am Anna Strict Standards: Non-static method TraitMethod::sayHello() should not be called statically, assuming $this from incompatible context in /in/KPVBC on line 20 Hello! My name is Anna
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/KPVBC on line 9
Process exited with code 255.