3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); function bar(int $foo): string { return $foo; } bar(123);
Output for 7.3.0alpha1 - 7.3.0rc3
Fatal error: Uncaught TypeError: Return value of bar() must be of the type string, int returned in /in/dtYQ9:7 Stack trace: #0 /in/dtYQ9(10): bar(123) #1 {main} thrown in /in/dtYQ9 on line 7
Process exited with code 255.
Output for 7.1.0 - 7.2.6
Fatal error: Uncaught TypeError: Return value of bar() must be of the type string, integer returned in /in/dtYQ9:7 Stack trace: #0 /in/dtYQ9(10): bar(123) #1 {main} thrown in /in/dtYQ9 on line 7
Process exited with code 255.
Output for hhvm-3.22.0
Fatal error: Uncaught TypeError: Value returned from function bar() must be of type string, int given in /in/dtYQ9:-1 Stack trace: #0 /in/dtYQ9(-1): bar() #1 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
Fatal error: Uncaught TypeError: Value returned from function bar() must be of type string, int given in /in/dtYQ9:7 Stack trace: #0 /in/dtYQ9(10): bar() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Warning: Unsupported declare 'strict_types' in /in/dtYQ9 on line 3 Parse error: syntax error, unexpected ':', expecting '{' in /in/dtYQ9 on line 5
Process exited with code 255.