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 TestC extends Basic{ use TraitMethod; public function sayHello($name, $lastname){ parent::sayHello(); TraitMethod::sayHello($name); echo ' '.$lastname; } } $objTestC = new TestC(); $objTestC->sayHello("Nikodem", "Niedowiarek");
based on rUNVh
Output for 7.0.0 - 7.2.0
Warning: Declaration of TestC::sayHello($name, $lastname) should be compatible with Basic::sayHello() in /in/p7T7Q on line 15 Hello world! Deprecated: Non-static method TraitMethod::sayHello() should not be called statically in /in/p7T7Q on line 20 Hello! My name is Nikodem Niedowiarek
Output for 5.6.8 - 5.6.28
Strict Standards: Declaration of TestC::sayHello() should be compatible with Basic::sayHello() in /in/p7T7Q on line 15 Hello world! Deprecated: Non-static method TraitMethod::sayHello() should not be called statically, assuming $this from incompatible context in /in/p7T7Q on line 20 Hello! My name is Nikodem Niedowiarek
Output for 5.4.11 - 5.5.35
Strict Standards: Declaration of TestC::sayHello() should be compatible with Basic::sayHello() in /in/p7T7Q on line 15 Hello world! Strict Standards: Non-static method TraitMethod::sayHello() should not be called statically, assuming $this from incompatible context in /in/p7T7Q on line 20 Hello! My name is Nikodem Niedowiarek
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/p7T7Q on line 9
Process exited with code 255.