Page 1 of 1
whats the @ for
Posted: Fri Dec 05, 2008 7:22 am
by PHPForever
mkdir and @mkdir - can anyone explain the difference ?
I ran a PHP script with both and they do the same thing.
Re: whats the @ for
Posted: Fri Dec 05, 2008 8:04 am
by VladSun
It's not a Linux related question, but a PHP related one.
http://www.faqts.com/knowledge_base/vie ... 068/fid/38
Re: whats the @ for
Posted: Fri Dec 05, 2008 10:14 am
by pickle
Moving to PHP-Code
Re: whats the @ for
Posted: Mon Dec 08, 2008 4:04 pm
by greyhoundcode
If you place an @ symbol in front of a command then it suppresses error messages. For example:
Code: Select all
if (!@mkdir($userGeneratedString))
{
echo 'The directory could not be created :-( ';
}
Now, if for some reason
$userGeneratedString equals a load of gibberish like
dsds££>:;4, instead of getting a PHP generated error message you can produce your own, or attempt to handle the error in some way.
Re: whats the @ for
Posted: Wed Jan 28, 2009 4:02 pm
by PHPForever
Got it. thanks.