I used this when I wanted to cause errors in PHP based on the background of PHP4. Note. To handle these errors, I had my own set_error_handler().
if ($error) {
trigger_error('Sorry, error has occured');
}
I cannot remember where, but once someone told me that I should โuse exceptionsโ. Since I am reviewing a lot of my old code, I decided it was time to get some good advice on my error handling.
Now that I'm using PHP5 (and a little smarter than when the old code was written), is my trigger_error()just the old way to do something, and if so, what is the best way to handle the error in PHP5?
source
share