Hey all,
I happened to catch on an ambiguous page describing one of the PHP functions that you can "mute" errors from functions by using the "at" (@) character immediately before the function name. (e.g.: @objConnection = @mysql_connect(...);)
I can't find any documentation on the PHP website other than the one liner I read on it. I was hoping someone may be able to send more info on it. What signals an "error"...is it a certain type of return variable that the @ sign recognizes, or what?
I'm not 100% sure, but I believe the Zend engine uses the error constants defined in the standard php build, e.g. E_ERROR, E_WARNING, E_NOTICE.
Also, is it possible to instantiate my own errors within a function such that the calling PHP code can use the @ sign when calling my function to detect an error from my function? Thank you!
Well, what are you wanting @ to do? What it does is suppress an error message for *just* the return value of a function. As an example, if your mysql_connect() fails then your webpage won't display sensitive information (can't connect to database blah). But if you want to have PHP detect errors from your functions you should use trigger_error.
http://www.php.net/trigger_error
If you are hoping to catch your errors and do something with them, you might create an error handler and use set_error_handler()
http://www.php.net/set_error_handler
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php