PHP has built-in functions for handling error messages. Some of the commonly used functions are:
1. die() - This function prints a message and terminates the script execution.
Code example:
if($x > 10){
die("Error: Value of x should not be greater than 10");
}
2. trigger_error() - This function generates a user-level error/warning/notice message and display it where your custom error handling function is defined.
Code example:
if(!file_exists("file.txt")){
trigger_error("Error: File does not exist", E_USER_WARNING);
}
Package library that may handle PHP error messages are Monolog, Bugsnag, and Whoops.
PHP message::error - 30 examples found. These are the top rated real world PHP examples of message::error extracted from open source projects. You can rate examples to help us improve the quality of examples.