Page 1 of 1
php equivilent to Java's try{}catch
Posted: Thu Oct 24, 2002 5:48 pm
by phpScott
Is there a php counterpart to Java's try{}catch synatax?
What I am trying to do is if my script encounters an error instead of getting the php error on the screen I want to be able to deal with the error myself.
Posted: Thu Oct 24, 2002 6:04 pm
by hob_goblin
from the manual:
All PHP expressions can also be called with the "@" prefix, which turns off error reporting for that particular expression. If an error occurred during such an expression and the track_errors feature is enabled, you can find the error message in the global variable $php_errormsg.
you can use these, the array functions, and some if statements to make your own version of it.
Posted: Thu Oct 24, 2002 6:18 pm
by sav
See PHP manual: Chapter 16. Error Handling - php error nandling code sample included, XXVII. Error Handling and Logging Functions
thanks
Posted: Thu Oct 24, 2002 6:20 pm
by phpScott
That was exactly what I was looking for. The overhead seems a little high though if there is an error, but I won't complain as hopefully there won't be to many errors.
phpScott