3v4l.org

run code in 300+ PHP versions simultaneously
<?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 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught TypeError: number(): Argument #1 ($integer_only) must be of type int, 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 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Argument 1 passed to number() must be of the type int, 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 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
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.

preferences:
185.38 ms | 401 KiB | 202 Q