Hindi Songs

Search About PHP!!!

Wednesday, July 8, 2009

Creating a Custom Error Handler

Creating a custom error handler is quite simple. We simply create a special function that can be called when an error occurs in PHP.

This function must be able to handle a minimum of two parameters (error level and error message) but can accept up to five parameters (optionally: file, line-number, and the error context):

Syntax

error_function(error_level,error_message,
error_file,error_line,error_context)

Parameter

Description

error_level

Required. Specifies the error report level for the user-defined error. Must be a value number. See table below for possible error report levels

error_message

Required. Specifies the error message for the user-defined error

error_file

Optional. Specifies the filename in which the error occurred

error_line

Optional. Specifies the line number in which the error occurred

error_context

Optional. Specifies an array containing every variable, and their values, in use when the error occurred