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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.