Solved

@ in php

Posted on 2006-11-16
5
223 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
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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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.

777 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