Jump to content

*SOLVED* @ symbol usage


acedanger

Recommended Posts

It surpresses error messages, which means it hides the error message which is good on a production server (live site) but not when you are on devlopment server (making your script).

Take this example:
[code]<?php

if($_GET['var']))
{
    echo $_GET['var'] . '<br /><br />';
}

?>
<a href="?var=hello">Set $_GET['var'] </a>[/code]
When you run that code depending on you error reporting level and whether display errors is enabled you'll get an notice message like this:
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Notice: Undefined index: var in path/to/file.php on line 3[/quote]
When you add the @ symbol in front of the $_GET['var'] variable it wont show the error message.

Hope that helps. I dont really recommend the use of the @ symbol, unless it is really nessecary, as it is a from of lazy programming.
Link to comment
https://forums.phpfreaks.com/topic/8704-solved-symbol-usage/#findComment-31946
Share on other sites

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.