You are here: Re: How is @ used? « PHP Language « IT news, forums, messages
Re: How is @ used?

Posted by Rik on 02/23/07 17:38

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 =3D @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 =3D @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 =3D dir(DIR_WS_INCLUDES . 'extra_configures');

-- =

Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация