syntax question

I have not been able to find documentation on the use of the at sign (@) other than comments concerning its use by the PhpDocumentor package for the purpose of identifying tags.

However…in the scripts for phpBB, the at sign appears randomly: for example in the install script -

[code]@import url("…/templates/subSilver/formIE.css");

$accept_lang_ary = explode(’,’, $HTTP_SERVER_VARS[‘HTTP_ACCEPT_LANGUAGE’]);
for ($i = 0; $i < sizeof($accept_lang_ary); $i++)
{
@reset($match_lang);
while (list($lang, $match) = each($match_lang))
{
if (preg_match(’#’ . $match . ‘#i’, trim($accept_lang_ary[$i])))
{
if (file_exists(@phpbb_realpath($phpbb_root_path . ‘language/lang_’ . $lang))) [/code]

Could someone please explain the use of the at sign?

The at sign is used for suppressing warnings/errors. Its put in front of functions to hide any errors/warnings that it may throw. Should only be used in production and never during development.

http://php.net/operators.errorcontrol

Wow, thanks for the fast response.

I must still lodge one pissy complaint, which is that regardless how I search (and have searched) the php documentation, ‘@’ as a search argument turns up “No Page”. fwiw, I also searched using ‘at sign’ and got the same response.

We do not maintain that or have anything to do with that, only use it as a powerful tool for looking up php functions and various other elements pertaining to PHP.

Sponsor our Newsletter | Privacy Policy | Terms of Service