teng84 Posted August 11, 2007 Share Posted August 11, 2007 ok it my first time to post a topic here pls lay me your reason of using @ i now what it is for but maybe i want to hear your opinion about this no wrong and correct answer just an idea Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/ Share on other sites More sharing options...
gerkintrigg Posted August 11, 2007 Share Posted August 11, 2007 normally the @ symbol precludes a line of code to avoid any errors even if the line would normally return a problem. I've never seen it at the end of a statement like you had it. Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-320831 Share on other sites More sharing options...
teng84 Posted August 11, 2007 Author Share Posted August 11, 2007 normally the @ symbol precludes a line of code to avoid any errors even if the line would normally return a problem. I've never seen it at the end of a statement like you had it. ok i remove that it was a joke but seems like its not for you well i just want an opinion why do you have to use it you know prevention is always better then cure Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-320833 Share on other sites More sharing options...
trq Posted August 11, 2007 Share Posted August 11, 2007 well i just want an opinion why do you have to use it You should avoid it where possible. Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-320860 Share on other sites More sharing options...
Guest Posted August 11, 2007 Share Posted August 11, 2007 Well, in some cases you may want to handle the error your own way. There are times where certain PHP functions don't throw Exceptions in PHP when they fail, but rather, result in a fatal error, bringing everything to an ugly halt. Like some of the Image functions. Instead, I'd prefer to suppress the error, and check to see if an error actually occured, then throw an exception and handle it gracefully. Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-320862 Share on other sites More sharing options...
teng84 Posted August 11, 2007 Author Share Posted August 11, 2007 ;D i have read this i think its on top of the board it says putting an @ simply means putting band aid so why not cure the wound something like that Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-320865 Share on other sites More sharing options...
hackerkts Posted August 11, 2007 Share Posted August 11, 2007 It simply just prevent it from showing the exact error, it's advise not to show any error(s) on your script. Error display on your site could cause it to get hack. Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-320920 Share on other sites More sharing options...
jitesh Posted August 11, 2007 Share Posted August 11, 2007 Error Control Operators PHP supports one error control operator: the at sign (@). When prepended to an expression in PHP, any error messages that might be generated by that expression will be ignored. If the track_errors feature is enabled, any error message generated by the expression will be saved in the variable $php_errormsg. This variable will be overwritten on each error, so check early if you want to use it. <?php /* Intentional file error */ $my_file = @file ('non_existent_file') or die ("Failed opening file: error was '$php_errormsg'"); // this works for any expression, not just functions: $value = @$cache[$key]; // will not issue a notice if the index $key doesn't exist. ?> Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-320921 Share on other sites More sharing options...
teng84 Posted August 11, 2007 Author Share Posted August 11, 2007 any idea about this @mysql_query('select here ......'); can you give me some reason why do you put that @ there instead of filtering completely the code hhmmm again for those who use this @@ lay me your idea Error display on your site could cause it to get hack. this answer sounds a little interesting Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-320923 Share on other sites More sharing options...
trq Posted August 11, 2007 Share Posted August 11, 2007 What part exactly do you not understand? Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-320944 Share on other sites More sharing options...
hackerkts Posted August 11, 2007 Share Posted August 11, 2007 It will just hide the error from showing to other people, example Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in... If you read about SQL Injection, hackers can make use of error display like telling them which table is not exist and which is exist to inject your database. Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-320948 Share on other sites More sharing options...
teng84 Posted August 12, 2007 Author Share Posted August 12, 2007 What part exactly do you not understand? the part i dont understand is that why do this people are fun of using this @@@ for me its like your saying that your code is not 100 percent Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-321940 Share on other sites More sharing options...
teng84 Posted August 12, 2007 Author Share Posted August 12, 2007 Error display on your site could cause it to get hack. ok this satisfy me Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-321944 Share on other sites More sharing options...
trq Posted August 12, 2007 Share Posted August 12, 2007 the part i dont understand is that why do this people are fun of using this @@@ for me its like your saying that your code is not 100 percent In English? Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-321945 Share on other sites More sharing options...
teng84 Posted August 12, 2007 Author Share Posted August 12, 2007 what? thorpe what do you mean Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-321946 Share on other sites More sharing options...
trq Posted August 12, 2007 Share Posted August 12, 2007 That last sentence makes little to no sense. If English isn't your native language, I understand, otherwise, you need to slow down and read your own replies. Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-321947 Share on other sites More sharing options...
teng84 Posted August 12, 2007 Author Share Posted August 12, 2007 i know what is @ for but im asking for the reason why do people use it like i said i only want an idea about this no wrong and correct answer my idea of using @ is that the code is not perfect meaning you are expecting some error so i want to know why do this people use this instead of filtering properly the code Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-321951 Share on other sites More sharing options...
trq Posted August 12, 2007 Share Posted August 12, 2007 Did 8ball's answer not satisfy you? Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-321952 Share on other sites More sharing options...
teng84 Posted August 12, 2007 Author Share Posted August 12, 2007 Error display on your site could cause it to get hack. ok this satisfy me Quote Link to comment https://forums.phpfreaks.com/topic/64343-solved-what-is-the-for/#findComment-321953 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.