Easy Tutorial
❮ Func String Localeconv Func String Stripos ❯

PHP error_log() Function



Definition and Usage

The error_log() function sends an error to the server's error log, a file, or a remote destination.

The function returns TRUE if successful, and FALSE if it fails.

Syntax

Parameter Description
error Required. The error message to be logged.
type Optional. Specifies the type of error logging. <br>Possible logging types: 0 - Default. The error is sent to the server's logging system or file based on the error_log configuration in the php.ini file. <br>1 - The error is sent to the address specified in the destination parameter. This type uses the headers parameter. <br>2 - The error is sent through the PHP debugging connection. This option is only available in PHP 3. <br>3 - The error is sent to the file target string.
destination Optional. Specifies where to send the error message. The value of this parameter depends on the type parameter.
headers Optional. Used only when the type parameter is 1. Specifies additional headers such as From, Cc, and Bcc. Additional headers are separated by CRLF (\r\n). Note: When sending an email, the From header must be included. It can be set in the php.ini file or through this parameter.

Example

The following example sends an email with a custom error:

The received email looks like this:

❮ Func String Localeconv Func String Stripos ❯