Jump to content


This topic is now archived and is closed to further replies.


*SOLVED* @ symbol usage

Recommended Posts

I've been searcing around the web and have noticed some people using the @ symbol in front of mysql_* functions. What does the @ symbol mean and what does it do?

Share this post

Link to post
Share on other sites
It surpresses error messages, which means it hides the error message which is good on a production server (live site) but not when you are on devlopment server (making your script).

Take this example:

    echo $_GET['var'] . '<br /><br />';

<a href="?var=hello">Set $_GET['var'] </a>[/code]
When you run that code depending on you error reporting level and whether display errors is enabled you'll get an notice message like this:
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Notice: Undefined index: var in path/to/file.php on line 3[/quote]
When you add the @ symbol in front of the $_GET['var'] variable it wont show the error message.

Hope that helps. I dont really recommend the use of the @ symbol, unless it is really nessecary, as it is a from of lazy programming.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.