3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); function number (int $integer_only) { echo "This is an interger! Correct!"; } /** * Let's see what happens when we pass in a string as a parameter */ $string = "This is a pretty string"; number($string);
Output for 7.0.28 - 7.2.11
Fatal error: Uncaught TypeError: Argument 1 passed to number() must be of the type integer, string given, called in /in/miget on line 14 and defined in /in/miget:5 Stack trace: #0 /in/miget(14): number('This is a prett...') #1 {main} thrown in /in/miget on line 5
Process exited with code 255.
Output for 5.6.38
Warning: Unsupported declare 'strict_types' in /in/miget on line 2 Catchable fatal error: Argument 1 passed to number() must be an instance of int, string given, called in /in/miget on line 14 and defined in /in/miget on line 5
Process exited with code 255.