3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(callable $fn) { } $oops = "somestring"; foo($oops);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Fatal error: Uncaught TypeError: foo(): Argument #1 ($fn) must be of type callable, string given, called in /in/R52G7 on line 9 and defined in /in/R52G7:3 Stack trace: #0 /in/R52G7(9): foo('somestring') #1 {main} thrown in /in/R52G7 on line 3
Process exited with code 255.
Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be callable, string given, called in /in/R52G7 on line 9 and defined in /in/R52G7:3 Stack trace: #0 /in/R52G7(9): foo('somestring') #1 {main} thrown in /in/R52G7 on line 3
Process exited with code 255.

preferences:
93.9 ms | 1536 KiB | 4 Q