"@" before variable name

Hi,
in some php script I saw the [at] char. What's causing it?

Sorry for my English and if you can, correct me. Please.
pronigo [ Mi, 14 Februar 2007 08:27 ] [ ID #1629277 ]

Re: "@" before variable name

Message-ID: <equdkl$71d$1 [at] news.task.gda.pl> from Adam B. contained the
following:

>in some php script I saw the [at] char. What's causing it?

In a php script I saw the ' [at] ' character. What does it do?


The ' [at] ' character prevents error messages being shown on the screen.

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow [ Mi, 14 Februar 2007 08:32 ] [ ID #1629278 ]

Re: "@" before variable name

Adam B. wrote:
> Hi,
> in some php script I saw the [at] char. What's causing it?
>
> Sorry for my English and if you can, correct me. Please.

The ' [at] ' is used to suppress error messages from functions.
Say you have a none important include() in your code, the script will work
without the include and the hard drive where you have that include may not
always be online, so instead of seeing all the warning messages printed out

--- example ---
Warning: include(something): failed to open stream: No such file or directory
in /www/yourscript.php on line 5

Warning: include(): Failed opening 'something' for inclusion
(include_path='.:/usr/share/php5:/usr/share/php') in /www/yourscript.php on line 5
--- eof ---

You want this pass silently away, then you use

[at] include('something');

--

//Aho
Shion [ Mi, 14 Februar 2007 08:36 ] [ ID #1629279 ]

Re: "@" before variable name

> The ' [at] ' is used to suppress error messages from functions.
Thanks, but I asked about " [at] " character before a variable name.
For example:

[at] $var = 'value';
pronigo [ Mi, 14 Februar 2007 08:57 ] [ ID #1629282 ]

Re: "@" before variable name

> Thanks, but I asked about " [at] " character before a variable name.
> For example:
>
> [at] $var = 'value';

http://www.php.net/manual/en/language.operators.errorcontrol .php
Peter [ Mi, 14 Februar 2007 09:14 ] [ ID #1629283 ]
PHP » alt.php » "@" before variable name

Vorheriges Thema: Email Authentication
Nächstes Thema: New 2 PHP