Suppressing PHP Errors & Warnings Using @
One part of making sure your website is secure in its hosting environment is to handle errors in a good fashion. If you don't have complete control of your hosting environment, you don't know what you can expect in the way of error handling if you don't do everything you can think of.
One method I use in all of my programming is to place an '@' character in front of function calls that have potential for returning warnings or errors.
@require($_SITE['ROOT'].$_FOLDERS['CONTROL'].'logger.php'); // suppress a file not found error
@mysql_connect($host,$user,$pass); // suppress no connection error
I recommend using the @ once your website is in production. I generally don't use the @ on development servers because I want to be aware of errors during development.
Santa Clara, CA · May 27-29th
Get 20% off with
This article serves as a point-by-point...
Sooner or later you’ll run across a regular expression. With their cryptic syntax, confusing documentation and massive learning curve, most developers settle for copying and pasting them from StackOverflow and hoping they work. But what if you could decode regular expressions and harness their power? In...