When the PHP engine found any issues in code, It will generate an error message. Sixteen types of error levels that characterize by integer value and Constant.
There are sixteen types of errors exist in PHP
Constant (Level) | Value | Description |
---|---|---|
E_ERROR |
1 | The Fatal run-time error stopped the execution of the script It can not recovered from |
E_WARNING |
2 | The Run-time error not stopped the execution of the script. |
E_PARSE |
4 | The Compile-time parse errors. This errors should only be generated by the parser. |
E_NOTICE |
8 | Run-time notice suggest the script encountered something. |
E_CORE_ERROR |
16 | A Fatal errors that happned PHP's engine startup.It is like
E_ERROR , except it is generated by the core of PHP.
|
E_CORE_WARNING |
32 | This is no-fatal errors that happned PHP's engine startup.It is like
E_WARNING , except it is generated by the core of PHP.
|
E_COMPILE_ERROR |
64 | This is compile-time fatal errors.It is like
E_ERROR , except it is generated by the Zend Scripting Engine.
|
E_COMPILE_WARNING |
128 | This is non-fatal errors, it is Compile-time warnings. This is like an
E_WARNING , except it is generated by the Zend
Scripting Engine.
|
E_USER_ERROR |
256 | A fatal User-generated error message. This is like an
E_ERROR , except it is generated in PHP code by
using the PHP function trigger_error().
|
E_USER_WARNING |
512 | User-generated warning message, It is non-fatal. This is like an
E_WARNING , except it is generated in PHP code by
using the PHP function trigger_error().
|
E_USER_NOTICE |
1024 | The User-generated notice message. This is like an
E_NOTICE , except it is generated in PHP code by
using the PHP function trigger_error().
|
E_STRICT |
2048 | E_STRICT will ensure the best interoperability and forward compatibility of your code. |
E_RECOVERABLE_ERROR |
4096 | A Catchable fatal error.If the error is not caught by a user defined handle (check also
set_error_handler()), the application sttoped as it
was an E_ERROR .
|
E_DEPRECATED |
8192 | It is run-time notices that indicate the script will not work in future versions. |
E_USER_DEPRECATED |
16384 | This is user-generated warning message. It is like an
E_DEPRECATED , except it is generated in PHP code by
using the PHP function trigger_error().
|
E_ALL |
32767 | All errors and warnings, as supported, except of level
E_STRICT prior to PHP 5.4.0.
|
error_reporting(0); //OR error_reporting(E_ALL); ini_set( 'display_errors',0);
As per example all errors and warnings will display
error_reporting(E_ALL); ini_set( 'display_errors',1);
error_reporting(E_ERROR); ini_set( 'display_errors',1);
error_reporting(E_ERROR & E_WARNING); ini_set( 'display_errors',1);
error_reporting(E_ALL & ~E_NOTICE); ini_set( 'display_errors',1);
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); ini_set( 'display_errors',1);