Home>Article>Backend Development> Introduction to php user_error() function

Introduction to php user_error() function

怪我咯
怪我咯 Original
2017-07-11 09:17:36 1806browse

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-inerror handlerroutine, or with a usercustom functionset by theset_error_handler() function.

This function is useful when you need to customize the error message under a specified condition when running the script.

If an illegal error type is specified, this function returns FALSE, otherwise it returns TRUE.

This function is an alias of thetrigger_error() function.

Syntax

user_error(error_message,error_types)


Parameters Description
error_message Required. Specifies the error message. Length limit is 1024 characters.
error_types Optional. Specifies the error type of the error message.

Possible error types:

  • E_USER_ERROR - User-generated fatal error at runtime. Unrecoverable error. Stop executing the script.

  • E_USER_WARNING - User-generated non-fatal warning at runtime. The script did not stop executing.

  • E_USER_NOTICE - Default. User-generated runtime notifications. Script discovery can be a bug, but can also occur when the script is running normally.


The above is the detailed content of Introduction to php user_error() function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn