trigger_error

bool trigger_error(string error_message, [int error_type]) 

Triggers an error.

Returns:

TRUE if the error could be generated; FALSE if the error_type argument is not a defined E_USER_* error type

Description:

trigger_error() is used to generate errors of the E_USER_ERROR, E_USER_WARNING, and E_USER_NOTICE type. Errors of this level can be caught by the built-in PHP error handler or can be handled by a custom error handler. See set_error_handler() for more details on custom error handlers.

Availability:

UNIX/Linux, Windows

Version:

4.0.1+

See also:

To use a custom error handler for errors:

set_error_handler() 

Examples:

Basic use of trigger_error()
# Call trigger_error() 
trigger_error ('Error message', E_USER_WARNING); 
Override ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.