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"; }

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
170.8 ms | 3002 KiB | 18 Q