I don’t know if I’d go as far as calling it stupid, but IMHO if it isn’t it’s darn close to it just about every time I’ve seen it used. That or lazy or ignorance.
I suppose there might be a scenario where it’s use can’t be helped, but I can’t think of any. Not as long as the code can be written a little more verbosely to handle the error in a better way. eg. if !== false, try-catch error/exception handling.
Especially since using it doesn’t stop the error, it just stops it from being reported. Like, if your smoke detector went off every time your stove caught fire, but its catching fire was a frequent event you accepted happening from time to time, you wouldn’t turn off your smoke detector would you?
It’s not necessarily bad, it is used in some of PHP’s examples(examples from php.net). When you’re doing reading of files and you’re not sure if there is an error in the file you can do stuff like
@$file = $this->parse_file();
if ($file) {
// Do someething
}
In this instance if there was an error was caused by parse_file() it would be supressed but $file to my guess would be false / null those wouldn’t drop into the if statement.
It is the most retarded thing to ever come into existence. If you even think about using this the god of programming will smite you so hard that all the letters will fly off your keyboard rendering you useless for at least a week.
I just spent 2 hours digging through code to find out why I was getting “Fatal error: Exception thrown without a stack frame in Unknown on line 0”. That would have been 2 minutes had the @ not been in front of the fileopen()
SERIOUSLY, DON’T EVEN THINK OF THINKING OF A PLACE THIS EVIL BEAST IS USEFUL.
Hi guys - new here, but Lisa, I have run across it before. I supervise a plethora of coders and this very instance caused quite an uproar at our company - simply put, we were not pleased with those that utilized it.
Its quite humorous (sort of) that this seems to prevelant in some circles.