3v4l.org

run code in 300+ PHP versions simultaneously
<?php function cExceptionHandler($exception) { $terminus = self::getInstance(); if ($exception instanceof c_Exception_Exit) { $msg = $exception->getMessage(); if ($msg) { echo $msg; } $terminus->doExit(1); } elseif ($exception instanceof c_Exception_Fatal) { $terminus->doDie($exception->getMessage()); } restore_exception_handler(); if (version_compare(PHP_VERSION, '5.3.0', '>=')) { $class = get_class($exception); throw new $class($exception->getMessage(), $exception->getCode(), $exception); } throw $exception; } set_exception_handler('cExceptionHandler'); throw new Exception('test');
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.28, 5.4.0 - 5.4.25
Fatal error: Cannot access self:: when no class scope is active in /in/PspDs on line 4
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/PspDs on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING in /in/PspDs on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/PspDs on line 6
Process exited with code 255.

preferences:
201.49 ms | 1395 KiB | 115 Q