die()
displays the error messages and terminates the running script if the given file is not found. This is a simple method to check if the file exist or not initially before trying to access it which is quite better to inform the user about the error occurred with ease. Value | Error Level | Description |
---|---|---|
1 | E_ERROR | Once this error occurs, user cannot recover from it. The script execution is terminated immediately. |
2 | E_WARNING | The error occurs at run-time and user can recover from this error. Most of the errors comes under this category only. It will not alter the execution. |
8 | E_NOTICE | It is an indication that something went wrong. |
256 | E_USER_ERROR | A fatal user-generated error message. This is like an E_ERROR, except it is generated by the PHP script using the function trigger_error() rather than the PHP engine. |
512 | E_USER_WARNING | This is similar to E_WARNING but generated by PHP function trigger_error() rather than the PHP engine. |
1024 | E_USER_NOTICE | A notice message created by the user similar to E_NOTICE, but created by PHP script with the function trigger_error() instead of PHP engine. |
2048 | E_STRICT | Not exactly an error, but can be occured when PHP finds code that may lead to problems or forward incompatibilities. |
8191 | E_ALL | All errors and warnings, except of E_STRICT prior to PHP 5.4.0. |
Parameter | Description |
---|---|
errno | Required - Defines error level, as an integer |
errstr | Required - Defines the error message as a string |
errfile | Optional - Defines script filename where the occurrence of error is seen |
errstr | Optional - Defines the line number on which the error occurred, as a string |
errno | Optional - Defines array having variables and their values that existed at the time the error occurred. |