Solved

@ in php

Posted on 2006-11-16
5
203 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
  • 2
  • 2
5 Comments
 
LVL 35

Assisted Solution

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

Assisted Solution

by:ch2
ch2 earned 150 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Other way to check id:

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

0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

728 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now