3v4l.org

run code in 300+ PHP versions simultaneously
<?php function f(int $foo) { var_dump($foo); } f(1); f(1.5); f("10"); f("10gaklj");
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
int(1) Deprecated: Implicit conversion from float 1.5 to int loses precision in /in/7rAQF on line 3 int(1) int(10) Fatal error: Uncaught TypeError: f(): Argument #1 ($foo) must be of type int, string given, called in /in/7rAQF on line 10 and defined in /in/7rAQF:3 Stack trace: #0 /in/7rAQF(10): f('10gaklj') #1 {main} thrown in /in/7rAQF on line 3
Process exited with code 255.
Output for 8.0.0 - 8.0.30
int(1) int(1) int(10) Fatal error: Uncaught TypeError: f(): Argument #1 ($foo) must be of type int, string given, called in /in/7rAQF on line 10 and defined in /in/7rAQF:3 Stack trace: #0 /in/7rAQF(10): f('10gaklj') #1 {main} thrown in /in/7rAQF on line 3
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
int(1) int(1) int(10) Notice: A non well formed numeric value encountered in /in/7rAQF on line 3 int(10)
Output for 7.3.32 - 7.3.33
int(1) int(1) int(10) int(10)
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Catchable fatal error: Argument 1 passed to f() must be an instance of int, integer given, called in /in/7rAQF on line 7 and defined in /in/7rAQF on line 3
Process exited with code 255.

preferences:
166.08 ms | 402 KiB | 183 Q