Solved

@ in php

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses how to create an extensible mechanism for linked drop downs.
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…
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 …

809 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