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!
[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.

Archived

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

×
×
  • 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.