3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_error_handler(function($num, $msg, $file, $line) { // Convert to exceptions throw new ErrorException($msg, 0, $num, $file, $line); }); set_exception_handler(function($e) { // Print or log to file echo get_class($e).': '.$e->getMessage().' ['.$e->getFile().':'.$e->getLine().']'; }); try { // Will be caught echo array(); } catch(ErrorException $e) {} // Will not be caught echo array();

preferences:
44.4 ms | 402 KiB | 5 Q