3v4l.org

run code in 300+ PHP versions simultaneously
<?php function error_handler($errno, $errstr, $errfile, $errline) { throw new ErrorException($errstr, $errno, $errno, $errfile, $errline); } set_error_handler('error_handler'); try { echo 5 / 0; } catch(ErrorException $error) { echo new ErrorExceptionHTMLDecorator($error); } /* WARNING Message: Division by zero Code: 2 Line: 71 File: C:\webroot\www\error.php */ class ErrorExceptionHTMLDecorator { protected $error; protected static $levels = array( E_ERROR => 'ERROR', E_WARNING => 'WARNING', E_PARSE => 'PARSING 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_STRICT => 'STRICT NOTICE', E_RECOVERABLE_ERROR => 'RECOVERABLE ERROR' ); public function __construct(ErrorException $error) { $this->error = $error; } public function render() { $level = isset(self::$levels[$this->error->getSeverity()]) ? self::$levels[$this->error->getSeverity()] : 'Unknown Error'; return sprintf( ' <h4>%s</h4> <strong>Message:</strong> %s<br /> <strong>Code:</strong> %d<br /> <strong>Line:</strong> %s<br /> <strong>File:</strong> %s<br /> ----------------------------------<br /> ', $level, $this->error->getMessage(), $this->error->getCode(), $this->error->getLine(), $this->error->getFile() ); } public function __toString() { return strip_tags($this->render()); } }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught DivisionByZeroError: Division by zero in /in/2o2oA:14 Stack trace: #0 {main} thrown in /in/2o2oA on line 14
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:
43.07 ms | 401 KiB | 8 Q