error_log
Function • Params and return types changed in PHP 8.0
Send an error message to the defined error handling routines.
error_log Function synopsis
error_log(
string $message,
int $message_type = 0,
?string $destination = null,
?string $additional_headers = null
): bool
Parameters
$message
Typestring
The error message that should be logged.
$message_type
OptionalTypeintDefault value0
Says where the error should go. The possible message types are as follows:
$destination
OptionalType?stringDefault valuenull
The destination. Its meaning depends on the
$message_type parameter as described above.
$additional_headers
OptionalType?stringDefault valuenull
The extra headers. It's used when the $message_type
parameter is set to 1.
This message type uses the same internal function as
mail does.
Return value
Typebool
Returns true on success, false on failure
If $message_type is zero, this function always returns true,
regardless of whether the error could be logged or not.
Changes to the error_log Function
PHP 8.0
- Return type added:
bool - Parameter type added for parameter #1 (
$message):string - Parameter type added for parameter #2 (
$message_type):int - Parameter default value added for position #2 (
$message_type):0 - Parameter type added for parameter #3 (
$destination):?string - Parameter default value added for position #3 (
$destination):null - Parameter name of parameter #4 changed:
$extra_headersto$additional_headers - Parameter type added for parameter #4 (
$additional_headers):?string - Parameter default value added for position #4 (
$additional_headers):null
error_log(
- $message,
+ string $message,
- $message_type,
+ int $message_type = 0,
- $destination,
+ ?string $destination = null,
- $extra_headers
+ ?string $additional_headers = null
- )
+ ): bool error_log Function Availability
error_log Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Unsupported | 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 |