View Full Version : "@" needed? mysql_connect
02-09-2010, 06:46 PM
Okay, I've been doing a lot of coding, and I dont see what this is used for?
@mysql_connect why not just
or same thing
what is the whole "@" deal?
02-09-2010, 07:07 PM
@ is the supression operator. Any errors that may be tossed by the usage of the function are ignored. @ is almost never required with proper error checking and trapping.
02-09-2010, 07:12 PM
Okay thanks. but is it more recommended to use it?
Although I'm guilty of using the error suppression operator myself on occasion, IMHO it is not recommended to use it, but rather to use proper error handling as Fou-Lu mentioned.
PHP Language Reference (http://www.php.net/langref) : Operators (http://us2.php.net/manual/en/language.operators.php) : Error control operators (http://us2.php.net/manual/en/language.operators.errorcontrol.php)
Keep that language reference handy, I recommend reading through it as much as you can to gain a good grasp on PHP.
02-09-2010, 08:25 PM
You should never need to use it with any well written code.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.