3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* final public ExceptionException::getPrevious ( void ) final public stringException::getFile ( void ) final private voidException::__clone ( void ) */ error_reporting(E_ALL); function exception_error_handler($errno, $errstr, $errfile, $errline ) { throw new ErrorException($errstr, '00007600', $errno, $errfile, $errline); } set_error_handler("exception_error_handler"); try { echo $x; } catch(Exception $e) { echo 'exception \'' . get_class($e) . '\' with message \'' . $e->getMessage() . '\' in \'' . $e->getFile() . '\':' . $e->getLine() PHP_EOL; echo $e->getTraceAsString(); echo PHP_EOL . '-----------------------' . PHP_EOL; echo $e->__toString(); }
Output for 5.4.0 - 5.4.24
Parse error: syntax error, unexpected 'PHP_EOL' (T_STRING), expecting ',' or ';' in /in/R4F0C on line 32
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /in/R4F0C on line 32
Process exited with code 255.

preferences:
194.79 ms | 1395 KiB | 61 Q