3v4l.org

run code in 300+ PHP versions simultaneously
<?php $errorTypes = [ E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parse Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_USER_DEPRECATED => 'Deprecated', E_STRICT => 'Strict Standards', E_RECOVERABLE_ERROR => 'Catchable Fatal' ]; $fatalErrorTypes = [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR]; function log_error($num, $str, $file, $line, $context = null, $exit = true) { global $errorTypes; global $fatalErrorTypes; $bFatal = true; if (isset($errorTypes[$num])) { $errType = $errorTypes[$num]; $bFatal = in_array($num, $fatalErrorTypes); } else { $errType = "Unknown error #$num"; } // would normally record stuff here echo "PHP $errType [$file:$line]: $str\n"; if ($bFatal && $exit) { die; } } function check_for_fatal() { global $fatalErrorTypes; $error = error_get_last(); if (in_array($error['type'], $fatalErrorTypes)) { log_error($error["type"], $error["message"], $error["file"], $error["line"], null, false); $output = '{"errors":[{"code":"internal_server_error"}]}'; // would normally record stuff here echo $output; } } function log_exception(\Exception $e) { echo get_class($e) . ': ' . $e->getMessage(); } register_shutdown_function('check_for_fatal'); set_error_handler('log_error'); set_exception_handler('log_exception'); $broken = null; echo $broken->length();
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: log_exception(): Argument #1 ($e) must be of type Exception, Error given in /in/koMt3:56 Stack trace: #0 [internal function]: log_exception(Object(Error)) #1 {main} thrown in /in/koMt3 on line 56 PHP Error [/in/koMt3:56]: Uncaught TypeError: log_exception(): Argument #1 ($e) must be of type Exception, Error given in /in/koMt3:56 Stack trace: #0 [internal function]: log_exception(Object(Error)) #1 {main} thrown {"errors":[{"code":"internal_server_error"}]}
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
67.14 ms | 401 KiB | 8 Q