Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why use @ before variable in PHP? [duplicate]

Tags:

php

Possible Duplicate:
What is the use of the @ symbol in PHP?
Reference — What does this symbol mean in PHP?

what does using <?php echo @$fnameerror; ?> mean. why use @ before variable in php

like image 427
shaz Avatar asked Nov 11 '10 04:11

shaz


People also ask

What does the & before variable in PHP mean?

It is used to pass a variable by reference.

What does it means & before variable?

It means pass the variable by reference, rather than passing the value of the variable.

What does mean in front of variable?

It means "the opposite of". So if the variable contains "false", then putting "!" in front will make the result "true".

What is the use of & in PHP?

The & is used to get a reference to a variable. It's similar to references in other languages like C++, with some significant differences. See the PHP Manual's section on references. Your thinking of the @ symbol.


2 Answers

error control operator .. suppresses error messages ..

like image 171
Scott Evernden Avatar answered Oct 11 '22 12:10

Scott Evernden


@ is pure evil. It's not a good idea to use. You can find an explanation about it here.

It can cause massive debugging headaches because it will even suppress critical errors.

like image 38
GWW Avatar answered Oct 11 '22 12:10

GWW