3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function foo(int $integer): int { return $integer; } var_dump(foo(1)); var_dump(foo("1")); var_dump(foo("a"));
Output for 7.0.0 - 7.2.0
int(1) int(1) Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be of the type integer, string given, called in /in/kXoBL on line 7 and defined in /in/kXoBL:3 Stack trace: #0 /in/kXoBL(7): foo('a') #1 {main} thrown in /in/kXoBL on line 3
Process exited with code 255.
Output for 5.3.22 - 5.6.28
Parse error: syntax error, unexpected ':', expecting '{' in /in/kXoBL on line 3
Process exited with code 255.