You are here: Re: "@" before variable name « All PHP « IT news, forums, messages
Re: "@" before variable name

Posted by J.O. Aho on 02/14/07 07:36

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

The '@' 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

@include('something');

--

//Aho

 

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

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