3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Test { public function first(string $str): string { function nested() { } return $str; } public function second(int $i): int { return $i; } } $t = new Test; echo $t->first("42"); echo $t->second(42);
based on 9ALr7
Output for 7.0.0 - 7.2.0
4242
Output for 5.3.20 - 5.6.28
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/IIHjf on line 5
Process exited with code 255.