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?int
Default 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_ALL
E_ERROR
E_WARNING
E_PARSE
E_NOTICE
E_STRICT
E_RECOVERABLE_ERROR
E_DEPRECATED
E_CORE_ERROR
E_CORE_WARNING
E_COMPILE_ERROR
E_COMPILE_WARNING
E_USER_ERROR
E_USER_WARNING
E_USER_NOTICE
E_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_level
to$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 AvailabilityPHP Version | Availability |
---|---|
PHP 8.5Future Release | Yes |
PHP 8.4Upcoming Release | Yes |
PHP 8.3Supported (Latest) | Yes |
PHP 8.2Supported | 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 |