tags:

views:

110

answers:

1

What does adding @ before a function do? I've seen this in some scripts

example:

$connect = @mysql_connect('localhost', 'root', 'password');
 instead of
$connect = mysql_connect('localhost', 'root', 'password');
+11  A: 

It suppresses any errors that might happen inside the function. Documentation here.

All things considered, this is not recommended as it can lead to some sneaky bugs.

Paolo Bergantino
What's with the edit?
Paolo Bergantino
Editing Nazi!
alex
Well I don't have a problem with someone improving a post of mine but to completely change the wording of it within minutes of me posting it is in poor taste at best...
Paolo Bergantino
Who can edit your answer? The asker?
KahWee Teng
@KahWee: anyone with 2000+ rep can edit questions and answers.
Paolo Bergantino
It's also slow. Don't use it; there is almost always another alternative.
orlandu63