function exceptionErrorHandler($errono, $errstr, $errfile, $errline){ throw new ErrorException($errstr, $errno, $errfile, $errline); } set_error_handler('exceptionErrorHandler'); error_reporting(E_ALL); try { $arr = array(); print $arr['a'] . "\n"; strpos(); } catch (Exception $e){ print $e->getMessage(). "\n"; print $e->getTraceAsString(). "\n"; }