PHP user_error() Function
Complete PHP Error Reference Manual
Definition and Usage
The user_error() function creates a user-defined error message.
The user_error() function is used to trigger an error message under user-specified conditions. It can be used with the built-in error handler or with a user-defined function set by set_error_handler().
This function is useful when you need to customize an error message under a specified condition while the script is running.
Returns FALSE if an invalid error type is specified, otherwise returns TRUE.
This function is an alias of the trigger_error() function.
Syntax
user_error(error_message,error_types)
| Parameters | Description |
|---|---|
| error_message | Required. Specifies the error message. Limited to 1024 characters in length. |
| error_types | Optional. Specifies the error type of the error message.
Possible error types: |
Example
1) { user_error("A custom error has been triggered"); } ?>The output of the code above is shown below:
Notice
: A custom error has been triggered
in
C:webfoldertest.php
on line
6
Complete PHP Error Reference Manual