Home > PHP > Function > Error Handling > error_reporting()

error_reporting()

error_reporting - Sets which PHP errors are reported

Syntax

int error_reporting (int $level)

Arguments

  • level - The new error_reportinglevel. It takes on either a bitmask, or named constants. Using named constants is strongly encouraged to ensure compatibility for future versions. As error levels are added, the range of integers increases, so older integer-based error levels will not always behave as expected. The available error level constants and the actual meanings of these error levels are described in the predefined constants.

Description

The error_reporting() function sets the error_reportingdirective at runtime. PHP has many levels of errors, using this function sets that level for the duration (runtime) of your script. If the optional level is not set, error_reporting() will just return the current error reporting level.

Version

PHP 4, 5

Return value

Returns the old error_reportinglevel or the current level if no level parameter is given.