error_reporting
Function • Params and return types changed in PHP 8.0
Sets which PHP errors are reported.
error_reporting Function synopsis
error_reporting(?int $error_level = null): int
Parameters
$error_level
OptionalType?intDefault valuenull
The new error_reporting level. 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.
$error_level accepts one or a bitmask of the following constant values:
E_ALLE_ERRORE_WARNINGE_PARSEE_NOTICEE_STRICTE_RECOVERABLE_ERRORE_DEPRECATEDE_CORE_ERRORE_CORE_WARNINGE_COMPILE_ERRORE_COMPILE_WARNINGE_USER_ERRORE_USER_WARNINGE_USER_NOTICEE_USER_DEPRECATED
Return value
Typeint
Returns the error_reporting level, before it is changed to
$error_level.
error_reporting returns one or a bitmask of the following constant values:
Changes to the error_reporting Function
PHP 8.0
- Return type added:
int - Parameter name of parameter #1 changed:
$new_error_levelto$error_level - Parameter type added for parameter #1 (
$error_level):?int - Parameter default value added for position #1 (
$error_level):null
- error_reporting($new_error_level)
+ error_reporting(?int $error_level = null): int error_reporting Function Availability
error_reporting Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Future Release | Yes |
| PHP 8.5Upcoming Release | Yes |
| PHP 8.4Supported (Latest) | Yes |
| PHP 8.3Supported | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Security-Fixes Only | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |