3v4l.org

run code in 300+ PHP versions simultaneously
<?php function f($errno, $errstr, $errfile, $errline ) { $args = func_get_args(); print_r($args); return true; } function exception_error_handler($errno, $errstr, $errfile, $errline ) { throw new ErrorException($errstr); } ++$lorem; set_error_handler('f'); ++$dolor; set_error_handler(function ($errno, $errstr, $errfile, $errline) { $args = func_get_args(); print_r($args); return true; }); ++$foo; set_error_handler("exception_error_handler"); try { preg_match("/foo(+/", null); echo "+valid\n"; } catch (ErrorException $e) { echo "-fail: ", $e->getMessage(), "\n"; } restore_error_handler(); ++$bar; restore_error_handler(); ++$ipsum; restore_error_handler(); ++$dolor;

preferences:
51.89 ms | 402 KiB | 5 Q