The PHP engine Trigger Errors is an error whenever it encounters a problem with the script, a user can also trigger errors themselves. It can help to make the application more robust, because it can flag potential problems before they turn into serious errors. It also means that the application can generate more user – friendly error messages.
To trigger an error from within the script, call the trigger_error() function, passing in the error message that will be generated:
trigger_error(“Mr.Aman, we have had a problem.”);
By default, trigger_error() raises an E_USER_NOTICE error, which is the equivalent of E_NOTICE that is, a relatively minor problem. A user can trigger an E_USER_WARNING error instead (a more serious problem), or an E_USER_ERROR error (a fatal error — raising this error stops the script from running):
trigger_error(“Mr.Aman, we have had a bigger problem.” E_USER_WARNING);
trigger_error(“Mr.Aman, we have had a huge problem.” E_USER_ERROR);