Re: The 'at' sign (@) variable prefix
| From: | Daniel Brown | Date: | Mon, 06 Oct 2008 19:17:28 +0000 |
| Subject: | Re: The 'at' sign (@) variable prefix | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-281506@lists.php.net to get a copy of this message | ||
On Mon, Oct 6, 2008 at 3:03 PM, Crash Dummy <gmane@thedatalist.com> wrote:
> I learned through osmosis that I could use the '@' sign to prevent an
> error with an uncertain variable. For example, if there is no $_GET[]
> value in this line,
>
> $query=$_GET["q"];
>
> I will get an error, but if I prefix the value with '@',
>
> $query=@$_GET["q"];
The @ is an error control operator, used to buffer the output and
store it in a variable - $php_errormsg.
Check it out:
http://php.net/manual/en/language.operators.errorcontrol.php
It's better to write clean, secure code, of course.... but
sometimes error control is a good thing, too.
--
</Daniel P. Brown>
More full-root dedicated server packages:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.