3v4l.org

run code in 300+ PHP versions simultaneously
<?php // 为避免污染全局命名空间,已对所有标识符加 `e` 前缀 /** * 运行模式 * * debug 调试模式, 会开启详细的日志记录和错误提示 * * default 默认模式, 会输出错误提示 * * production 生产模式, 不会执行任何额外操作, 最高效地执行代码 */ const eDebug = 2; const eDefault = 1; const eProduction = 0; const eRunMode = eDefault; // 默认关掉所有错误提示 error_reporting(0); // 如果是默认模式,打开致命错误和解析错误的报告 if(eRunMode >= eDefault) error_reporting(E_ERROR | E_PARSE); // 如果是调试模式,打开全部错误提示,并启用修改建议提示 if(eRunMode >= eDebug) error_reporting(E_ALL | E_STRICT); class ePHPException extends Exception { protected $severity; protected $varList; public function __construct($message = "", $code = 0, $severity = 1, $filename = __FILE__, $lineno = __LINE__, Exception $previous = null, $varList = []) { $this->severity = $severity; $this->file = $filename; $this->line = $lineno; $this->varList = $varList; parent::__construct($message, $code, $previous); } public function getSeverity() { return $this->severity; } public function getVarList() { return $this->varList; } }

preferences:
36.66 ms | 402 KiB | 5 Q