3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function foo(): int { return null; } var_dump(foo());
Output for 7.3.0alpha1 - 7.3.0beta1
Fatal error: Uncaught TypeError: Return value of foo() must be of the type int, null returned in /in/XQB6a:4 Stack trace: #0 /in/XQB6a(7): foo() #1 {main} thrown in /in/XQB6a on line 4
Process exited with code 255.
Output for 7.0.30 - 7.2.7
Fatal error: Uncaught TypeError: Return value of foo() must be of the type integer, null returned in /in/XQB6a:4 Stack trace: #0 /in/XQB6a(7): foo() #1 {main} thrown in /in/XQB6a on line 4
Process exited with code 255.
Output for hhvm-3.22.0
Fatal error: Uncaught TypeError: Value returned from function foo() must be of type int, null given in /in/XQB6a:-1 Stack trace: #0 /in/XQB6a(-1): foo() #1 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
Fatal error: Uncaught TypeError: Value returned from function foo() must be of type int, null given in /in/XQB6a:4 Stack trace: #0 /in/XQB6a(7): foo() #1 {main}
Process exited with code 255.
Output for 5.6.30
Parse error: syntax error, unexpected ':', expecting '{' in /in/XQB6a on line 3
Process exited with code 255.