Jaka jest różnica między tymi dwoma wywołaniami funkcji w PHP?
init_get($somevariable);
@init_get($somevariable);
Odpowiedzi:
the "@" will silence any php errors your function could raise.
@
in front of PHP's trigger_error
function? I have seen that in some code, but its behavior is inconsistent for me so far. In some cases, I do see the error being reported by the configured error handler and in other cases it does seem to get reported.
@
will temporarily set error_reporting
to 0 but will not "suppress" the error.
It silences errors and warnings. See Error Control Operators.
As already answered the @
will stop the error (if any) from showing up.
In terms of performance this is not recommended.
What php is doing is:
If you don't want any errors showing up use error_reporting(0);
.
Or just write bug free code :P
http://www.faqts.com/knowledge_base/view.phtml/aid/18068/fid/38
All PHP expressions can be called with the "@" prefix, which turns off error reporting for that particular expression.
As everyone said, it stops the output of errors for that particular function. However, this decreases performance greatly since it has to change the error display setting twice. I would recommend NOT ignoring warnings or errors and fixing the code instead.