Re: The 'at' sign (@) variable prefix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 6, 2008 at 3:03 PM, Crash Dummy <gmane@xxxxxxxxxxxxxxx> 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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux