Home >Backend Development >PHP Tutorial >How to use php trigger_error() function?
trigger_error() Function Creates a user-level error message. The
trigger_error() function can be associated with the built-in error handler, or a user-defined function can be used as a new error handler (set_error_handler()) .
Syntax
trigger_error(errormsg,errortype);
Description | |
---|---|
errormsg | Required. Specifies the error message. Maximum length 1024 bytes.|
errortype | Optional. Specifies the error type. Possible values: |
<?php if ( $divisor == 0 ) { trigger_error ( "Cannot divide by zero" , E_USER_ERROR ); } ?>
The above is the detailed content of How to use php trigger_error() function?. For more information, please follow other related articles on the PHP Chinese website!