'@' is PHP's error-supression operator. It is described in the PHP online manual here.
As a general rule, use of the "@" operator is not a good idea. It can supress errors you really need to see, and some programmers use it instead of code to handle errors gracefully.
Based on sleipnir's answer, that should be obvious. You don't get an error if you use error-supression operator, because it supresses the error. If there is none, error appears. If you show us the error we might help you explain what you're doing wrong and you could avoid the error in the first place (not just supress it).
I posted a link to a page in the PHP online manual. If you have not done so already, I strongly recommend reading the page at that link. I can't explain it better than the manual does.
As to what "to supress" means, sorry, but I was mispelling the word. I should have spelled it "suppress", and the definition can be found here. Every meaning but meaning 4 could be applied here, and with the way some programmers use the "@"-operator, meaning 4 is appropriate, too.
Every function can either return a positive result (if everything works) or an error (if something unexpected happened). Errors (in non-user defined functions) usually arise because of too few, too many or incorrect (type) parameters. You can use the error-suppression operator (@) to hide these errors and ignore them. Simply, if this function gives you the error, do not show it and ignore it. Using this operator does have a good point. You can use it to write your own error-handling mechanism. In this case you will hide the default errors php gives you and handle the errors in your own script. However, if this is not what you're trying to do, supressing (hiding) errors is not smart, because your code produces some errors and does not work like you meant it to work, but you don't know what is wrong, because you hid the errors.
For your case, you should remove the @ operator and run the code. Paste the error in here along with the code and we will be able to tell you what's wrong with it, and you can then fix it so that it works and you don't need to use error supression.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.