Jump to content

The @ sign, What does it do exactly?


mouse_8b

Recommended Posts

The '@' symbol is a run-time error suppressing technique. Basically, what happens is that when you make a mysql function call, if something goes wrong, you'll see some sort of error or warning on your webpage. If you preface the function call with the '@', those errors and/or warnings will disappear. This is typically only a good idea [b]if you are handling errors manually[/b], such as with PHP5's try catch clauses.

Hope this helps!
Link to comment
Share on other sites

[quote author=weknowtheworld link=topic=121770.msg501482#msg501482 date=1168453878]
I think during programming period you must not use @ sign to see errors in our programming but during final delivery please. use it..  :)
[/quote]

Actually, I would still discourage using it. At that point, for [i]final production[/i] as you say, I would simply set the server to not display any errors or warnings on your production environment. This is much cleaner than runtime error suppression. Plus, when you test new changes on your dev environment, you don't have to modify all your queries to have the '@' in front of them before moving over to the prod box. IMHO, the closer you can keep your dev and prod code, the better for debugging. The [b]only[/b] time I would recommend someone (blanket statement here) to consider using this method of error suppression is when you're developing with PHP5, and you're using the proper Exception throwing and handling like I mentioned above.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.