3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); function foo(int $n) : int { return 666.0; } $r = foo(12);
Output for 7.3.0alpha1 - 7.3.0rc4
Fatal error: Uncaught TypeError: Return value of foo() must be of the type int, float returned in /in/RmVuu:6 Stack trace: #0 /in/RmVuu(9): foo(12) #1 {main} thrown in /in/RmVuu on line 6
Process exited with code 255.
Output for 7.0.0 - 7.2.11
Fatal error: Uncaught TypeError: Return value of foo() must be of the type integer, float returned in /in/RmVuu:6 Stack trace: #0 /in/RmVuu(9): foo(12) #1 {main} thrown in /in/RmVuu on line 6
Process exited with code 255.
Output for hhvm-3.21.3 - 3.22.0
Fatal error: Uncaught TypeError: Value returned from function foo() must be of type int, float given in /in/RmVuu:-1 Stack trace: #0 /in/RmVuu(-1): foo() #1 {main}
Process exited with code 255.
Output for hhvm-3.11.1 - 3.21.0
Fatal error: Uncaught TypeError: Value returned from function foo() must be of type int, float given in /in/RmVuu:6 Stack trace: #0 /in/RmVuu(9): foo() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.1
Fatal error: Syntax only allowed in Hack files (<?hh) or with -v Eval.EnableHipHopSyntax=true in /in/RmVuu on line 5
Process exited with code 255.
Output for 5.5.0 - 5.6.38
Warning: Unsupported declare 'strict_types' in /in/RmVuu on line 3 Parse error: syntax error, unexpected ':', expecting '{' in /in/RmVuu on line 5
Process exited with code 255.