Solved

@ in php

Posted on 2006-11-16
5
244 Views
Last Modified: 2006-11-29
<?php

// Load key from QueryString
$bCopy = true;
$x_id = @$_GET["id"];

WHAT IS @ IN THE CODE ABOVE
0
Comment
Question by:teera
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 35

Assisted Solution

by:Raynard7
Raynard7 earned 150 total points
ID: 17962014
The @ supresses any error messages.
0
 
LVL 11

Assisted Solution

by:ch2
ch2 earned 150 total points
ID: 17962144
You can read more about this here. http://www.php.net/operators.errorcontrol
0
 
LVL 19

Assisted Solution

by:BrianGEFF719
BrianGEFF719 earned 50 total points
ID: 17962483
You really dont need the @ in the context above. If "id" doesnt exist it will simply return a blank string.

0
 
LVL 35

Accepted Solution

by:
Raynard7 earned 150 total points
ID: 17962503
You would be better however doing

if (isset($_GET["id"])){
    $x_id = $_GET["id"];
} else {
   // whatever error handling is required / setting x_id to a default value
}
0
 
LVL 11

Assisted Solution

by:ch2
ch2 earned 150 total points
ID: 17963531
Other way to check id:

$x_id = isset($_GET['id']) ? $_GET['id'] : 'DefaultValue';

0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question