ollie007 Posted June 10, 2009 Share Posted June 10, 2009 $comment = @$comment_desc[$type]; what does it mean? Quote Link to comment https://forums.phpfreaks.com/topic/161638-what-does-in-front-of-variable-mean/ Share on other sites More sharing options...
Jibberish Posted June 10, 2009 Share Posted June 10, 2009 It turns off error reporting for that particular expression I think. Quote Link to comment https://forums.phpfreaks.com/topic/161638-what-does-in-front-of-variable-mean/#findComment-852922 Share on other sites More sharing options...
gevans Posted June 10, 2009 Share Posted June 10, 2009 Not turn off exactly (though you're not wrong). It supresses errors. If you're not fully comfortable with it, I wouldn't recommend it at this stage. I use it to supress the mail() function when working locally, as I don't have a mailing facility through my set up. Apart from that I prefer catching all errors, as you should. Quote Link to comment https://forums.phpfreaks.com/topic/161638-what-does-in-front-of-variable-mean/#findComment-852925 Share on other sites More sharing options...
Daniel0 Posted June 10, 2009 Share Posted June 10, 2009 Not turn off exactly (though you're not wrong). Actually, it's quite accurate saying it turns them off. The way it works internally is that it sets error_reporting=0, executes the statement and then reverts error_reporting to whatever it was before. This is what makes it so inefficient. This: @someFunction(); is equivalent to $oldErrorReporting = error_reporting(0); someFunction(); error_reporting($oldErrorReporting); Quote Link to comment https://forums.phpfreaks.com/topic/161638-what-does-in-front-of-variable-mean/#findComment-852997 Share on other sites More sharing options...
haku Posted June 10, 2009 Share Posted June 10, 2009 More often than not, it really shouldn't be used. There are a couple functions out there that output errors when they aren't executed, at which point it can be a good thing, but most people who use it are just being sloppy in their programming. Quote Link to comment https://forums.phpfreaks.com/topic/161638-what-does-in-front-of-variable-mean/#findComment-853062 Share on other sites More sharing options...
TGWSE_GY Posted June 10, 2009 Share Posted June 10, 2009 I tend to agree with haku! Quote Link to comment https://forums.phpfreaks.com/topic/161638-what-does-in-front-of-variable-mean/#findComment-853066 Share on other sites More sharing options...
PFMaBiSmAd Posted June 10, 2009 Share Posted June 10, 2009 On a live server, display_errors will be OFF (and if they are not, you should globally make them off), so there is no reason at all to use @ in any code. On a development system, where display_errors would be ON, you want to see all errors, even if to just confirm that your code is executing down an expected path when something like a mail server is not available. Quote Link to comment https://forums.phpfreaks.com/topic/161638-what-does-in-front-of-variable-mean/#findComment-853188 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.