What is the function of the @ symbol in front of the php code? Description of the function of the @ operator

common problem zero four hundred and forty-two

@The symbol is used in php code to mask/ignore the error prompt information generated by the expression. The @ operator is only valid for expressions. It can be called in variables, constants, functions and include(), but it cannot be used before the definition of functions or classes, or in conditional structures (such as if and foreach).

Generally speaking, after using the @ symbol, the statement following the @ symbol will not give an error prompt even if there is an error.

 What is the function of the @ symbol in front of the php code? Description of the function of the @ operator

If the track_errors function is enabled, the error message generated by the expression will be saved in the variable $php_errormsg, and each error will overwrite this variable.

Code example:

 $getSize = @filesize('../default.jpg');

The filesize() function returns the number of bytes of the file size if it succeeds. If it fails, it returns false and generates an E_WARNING error. After the @ symbol is used in front of filesize(), the E_WARNING error prompt will not appear on the page.

Message from netizens:

I would like to comment:

◎ Welcome to participate in the discussion. Please express your views and exchange your views here.
 Verification Code