In this article, you will learn how to get the reported errors. The error_reporting() function in PHP specifies which errors are reported. In PHP there are many levels of errors, and using this function sets that level for the current script.
what is the syntax of the ERROR_REPORTING() function in php?
error_reporting(level);
Parameter | Description |
---|---|
level | Optional. Specifies the error-report level for the current script. |
examples of the ERROR_REPORTING() function
Example 1. In this example, we specify different error level reporting.
<?php
// Turn off error reporting
error_reporting(0);
// Report runtime errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Report all errors
error_reporting(E_ALL);
// Same as error_reporting(E_ALL);
ini_set("error_reporting", E_ALL);
// Report all errors except E_NOTICE
error_reporting(E_ALL & ~E_NOTICE);
?>