|
Intentionally throw PHP errors |
|
|
|
|
Written by Marion Consulting
|
|
Error messages are not something that most developers enjoy seeing, but they can be very useful especially when debugging or testing an applications code. Sometimes we would like throw an error to see how the application behaves and below is an example of how to do just this. trigger_error Generates a user-level error/warning/notice message (PHP 4 >= 4.0.1, PHP 5) bool trigger_error ( string error_msg [, int error_type] ) error_msg The designated error message for this error. It's limited to 1024 characters in length. Any additional characters beyond 1024 will be truncated. error_type The designated error type for this error. It only works with the E_USER family of constants, and will default to E_USER_NOTICE. Example usage: trigger_error ('I just threw an error", E_USER_ERROR); |