Understanding Error Levels In PHP

Whenever any error occur while running the script then the PHP engine triggers an error.

There are fifteen different levels of errors are available in PHP, and each level is represented by an integer value and an associated constant. Here, we will discuss all the different levels of errors in brief.

Error Level Value Description
E_ERROR 1 At this error level, runtime error cannot be recovered from and script stops running immediately.
E_WARNING 2 At this error level, runtime warning describes that the script can continue to run, a situation has occurred that could cause problems down the line such as dividing by zero or trying to read a nonexistent file. Most errors tend to fall into this category.
E_PARSE 4 At this error level, the script could not be run as there was a problem parsing it such as a syntax error.
E_NOTICE 8 At this error level, it could indicate an error, although the situation could also occur during normal running.
E_CORE_ERROR 16 At this level, a fatal error occurred during the PHP engine’s startup.
E_CORE_WARNING 32 At this level, a non – fatal error occurred during the PHP engine’s startup.
E_COMPILE_ERROR 64 At this level, a fatal error occurred while the script was being compiled.
E_COMPILE_WARNING 128 At this level, a non – fatal error occurred while the script was being compiled.
E_USER_ERROR 256 It is same as E_ERROR, but triggered by the script rather than the PHP engine.
E_USER_WARNING 512 It is same as E_WARNING, but triggered by the script rather than the PHP engine.
E_USER_NOTICE 1024 It is same as E_NOTICE, but triggered by the script rather than the PHP engine.
E_STRICT 2048 It is not strictly an error, but triggered whenever PHP encounters code that could lead to problems or incompatibilities.
E_RECOVERABLE_ERROR 4096 At this level, the error was fatal, but it did not leave the PHP engine in an unstable state.
E_DEPRECATED 8192 At this level an error describes a warning about code that will not work in future versions of PHP.
E_USER_DEPRECATED 16384 It is same as E_DEPRECATED, but triggered by the script rather than the PHP engine.

By default, only fatal errors will cause your script to stop running.