mkdir and @mkdir - can anyone explain the difference ?
I ran a PHP script with both and they do the same thing.
whats the @ for
Moderator: General Moderators
Re: whats the @ for
It's not a Linux related question, but a PHP related one.
http://www.faqts.com/knowledge_base/vie ... 068/fid/38
http://www.faqts.com/knowledge_base/vie ... 068/fid/38
There are 10 types of people in this world, those who understand binary and those who don't
Re: whats the @ for
Moving to PHP-Code
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
- greyhoundcode
- Forum Regular
- Posts: 613
- Joined: Mon Feb 11, 2008 4:22 am
Re: whats the @ for
If you place an @ symbol in front of a command then it suppresses error messages. For example:
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.
Code: Select all
if (!@mkdir($userGeneratedString))
{
echo 'The directory could not be created :-( ';
}-
PHPForever
- Forum Newbie
- Posts: 14
- Joined: Sun Aug 31, 2008 11:31 am
Re: whats the @ for
Got it. thanks.