PHP trigger_error() Function
Example
If $usernum > 10, trigger an error:
<?php
if ($usernum>10) {
    trigger_error("Number cannot be larger than 10");
 }
 ?>
Try it Yourself »
Definition and Usage
The trigger_error() function creates a user-level error message.
The trigger_error() function can be used with the built-in error handler, or with a user-defined function set by the set_error_handler() function.
Syntax
trigger_error(message, type)
Parameter Values
| Parameter | Description | 
|---|---|
| message | Required. Specifies the error message for this error. Max 1024 bytes in length | 
| type | Optional. Specifies the error type for this error. Possible values:
 
  | 
  
Technical Details
| Return Value: | FALSE if wrong error type is specified, TRUE otherwise | 
|---|---|
| PHP Version: | 4.0.1+ | 
PHP Error Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.