3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait TestTrait { public function execute(int $id) { return $id + 1; } } class TestClass { use TestTrait { execute as executeTrait; } function __construct() { var_dump($this->execute(1)); var_dump($this->executeTrait(2)); } } new TestClass();
based on gvRKc
Output for 7.0.0 - 7.2.0
int(2) int(3)
Output for 5.4.2 - 5.6.28
Catchable fatal error: Argument 1 passed to TestClass::execute() must be an instance of int, integer given, called in /in/ANmkM on line 19 and defined in /in/ANmkM on line 5
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/ANmkM on line 3
Process exited with code 255.