How to use error reporting in PHP

This article describe about error_reporting() function in PHP.
  • 1759

error_reporting() function

This function define which error occur or reported.

And This function also set which errors are reported for the current script duration.

Returns old error_reporting level.


error_reporting ( report_level)

Report level

Value Constant Description
1 E_ERROR Fatal runtime error.
2 E_WARNING Non fatal runtime error.
4 E_PARSE Compile time parse error.
8 E_NOTICE Runtime notice.
16 E_CORE_ERROR Fatal error at PHP startup.
32 E_CORE_WARNING Non fatal error at PHP startup.
64 E_COMPILE_ERROR Fatal compile time error.
128 E_COMPILE_WARNING Non fatal compile time error.
256 E_USER_ERROR Fatal user generate error.
512 E_USER_WARNING Non fatal user generate error.
1024 E_USER_NOTICE User generated notice.
2048 E_STRICT Runtime notice.
4096 E_RECOVERABLE_ERROR Catchable fatal error.
8191 E_ALL All error and warning. except level E_STRICT


//Disable error reporting

//Report runtime errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);

//Report all errors

Note: this program does not return any output only report to server if error occurred.

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here


More Articles

© 2020 DotNetHeaven. All rights reserved.