3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); function foo(int $i) { echo $i; } foo("10 ducks in a row");
based on MpBYL
Output for 7.0.0 - 7.2.6
Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be of the type integer, string given, called in /in/45aZc on line 8 and defined in /in/45aZc:4 Stack trace: #0 /in/45aZc(8): foo('10 ducks in a r...') #1 {main} thrown in /in/45aZc on line 4
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be an instance of int, string given in /in/45aZc:6 Stack trace: #0 /in/45aZc(8): foo() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Warning: Unsupported declare 'strict_types' in /in/45aZc on line 2 Catchable fatal error: Argument 1 passed to foo() must be an instance of int, string given, called in /in/45aZc on line 8 and defined in /in/45aZc on line 4
Process exited with code 255.