Last active
April 25, 2018 22:19
-
-
Save yesasha/fc1307125127c1bda87b328cbf3d9fc7 to your computer and use it in GitHub Desktop.
Convert error code to friendly readable string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Convert error code to friendly readable string. | |
* http://php.net/manual/ru/errorfunc.constants.php | |
* | |
* @param number $type | |
* @return string | |
*/ | |
function friendly_error_type ($type) { | |
switch($type) { | |
case E_ERROR: | |
return 'E_ERROR'; // 1 // | |
case E_WARNING: | |
return 'E_WARNING'; // 2 // | |
case E_PARSE: | |
return 'E_PARSE'; // 4 // | |
case E_NOTICE: | |
return 'E_NOTICE'; // 8 // | |
case E_CORE_ERROR: | |
return 'E_CORE_ERROR'; // 16 // | |
case E_CORE_WARNING: | |
return 'E_CORE_WARNING'; // 32 // | |
case E_COMPILE_ERROR: | |
return 'E_COMPILE_ERROR'; // 64 // | |
case E_CORE_WARNING: | |
return 'E_CORE_WARNING'; // 128 // | |
case E_USER_ERROR: | |
return 'E_USER_ERROR'; // 256 // | |
case E_USER_WARNING: | |
return 'E_USER_WARNING'; // 512 // | |
case E_USER_NOTICE: | |
return 'E_USER_NOTICE'; // 1024 // | |
case E_STRICT: | |
return 'E_STRICT'; // 2048 // | |
case E_RECOVERABLE_ERROR: | |
return 'E_RECOVERABLE_ERROR'; // 4096 // | |
case E_DEPRECATED: | |
return 'E_DEPRECATED'; // 8192 // | |
case E_USER_DEPRECATED: | |
return 'E_USER_DEPRECATED'; // 16384 // | |
default: | |
return ''; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment