trigger_error
Function • Return type changed in PHP 8.4
Generates a user-level error/warning/notice message.
trigger_error
Function synopsis
trigger_error(string $message, int $error_level = E_USER_NOTICE): true
Parameters
$message
Typestring
The designated error message for this error. It's limited to 1024 bytes in length. Any additional characters beyond 1024 bytes will be truncated.
$error_level
OptionalTypeint
Default valueE_USER_NOTICE
The designated error type for this error. It only works with the E_USER_*
family of constants, and will default to E_USER_NOTICE
.
$error_level
accepts one of the following constant values:
Return value
Typetrue
Always returns true
Changes to the trigger_error
Function
PHP 8.4
- Return type changed:
bool
totrue
- trigger_error(string $message, int $error_level = E_USER_NOTICE): bool
+ trigger_error(string $message, int $error_level = E_USER_NOTICE): true
PHP 8.0
- Return type added:
bool
- Parameter type added for parameter #1 (
$message
):string
- Parameter name of parameter #2 changed:
$error_type
to$error_level
- Parameter type added for parameter #2 (
$error_level
):int
- Parameter default value added for position #2 (
$error_level
):E_USER_NOTICE
- trigger_error($message, $error_type)
+ trigger_error(string $message, int $error_level = E_USER_NOTICE): bool
trigger_error
Function Availability
trigger_error
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 |