Results 1 to 1 of 1
Sep 29, 2011, 05:31 #1
- Join Date
- Jan 2008
- Knoxville TN
- 51 Post(s)
- 0 Thread(s)
PHP Function of the Day (2011-9-29): trigger_error
trigger_error creates an error message with an associated code. Depending on the code used the error can bring the program to a halt or simply get caught by the error handling in place.
While using try/catch and throw with exceptions has largely eclipsed trigger error in many PHP libraries it still has it's place. The most important difference is that if an error is caught and handled code will resume after the point in the code trigger_error was called. Exceptions do not behave this way - when a throw occurs the remaining code in that scope will not execute, and neither will any other code above it as the exception bubbles outward.
Trigger Error can be used to notify you of troublesome but not necessarily fatal conditions. The most common is illegal property access on objects.