|
Posted by rog on 02/23/07 17:56
Thanks Rik.
R
"Rik" <luiheidsgoeroe@hotmail.com> wrote in message
news:op.tn7pywgfqnv3q9@misant...
On Fri, 23 Feb 2007 18:09:08 +0100, rog <jk!ttop5@mnpX$.net> wrote:
> I keep running across @ used perhaps as some kind of operator.
> How is it used in php syntax.
> ie.
> $za_dir = @dir(DIR_WS_INCLUDES . 'extra_configures')
>
> I think this is poorly discussed/marked in the php online manual.
> It's listed among the operators
> ~ - (int) (float) (string) (array) (object) @
> and supposedly defined under the 'types' but there's no mention.
It's an error suppressor, if the following function creates an error it's
nor reported. You should almost never need this, often it's a sign of
sloppy code when it's littered with @'s. On a live server, offcourse you
don't want to display the errors to your poublic, that's why we have the
setting 'display_errors', which you can set to false.
In this case, instead of:
$za_dir = @dir(DIR_WS_INCLUDES . 'extra_configures');
THe author should have:
if(!is_dir(DIR_WS_INCLUDES . 'extra_configures')){
//do some error handling
return false;
}
$za_dir = dir(DIR_WS_INCLUDES . 'extra_configures');
--
Rik Wasmus
[Back to original message]
|