3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo($foo) { echo "Executing foo\n"; } set_error_handler(function($errno, $errstr) { $errors = array_filter(array_keys(get_defined_constants()), function($v) { return strncmp($v, "E_", 2) == 0; }); $errors = array_combine($errors, array_map("constant", $errors)); throw new Exception(array_search($errno, $errors) . ": " . $errstr); }); try { foo(); } catch (Exception $e) { echo $e->getMessage(), "\n"; }
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo(), 0 passed in /in/haASA on line 14 and exactly 1 expected in /in/haASA:3 Stack trace: #0 /in/haASA(14): foo() #1 {main} thrown in /in/haASA on line 3
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38, 7.0.0 - 7.0.32
E_WARNING: Missing argument 1 for foo(), called in /in/haASA on line 14 and defined

preferences:
218.37 ms | 402 KiB | 370 Q