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

common problem zero three hundred and seventy-three

@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 track is enabled_ Errors function, the error message generated by the expression will be saved in the variable $php_ In errormsg, each error will overwrite this variable.

Code example:

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

The filesize() function returns the number of bytes of the file size on success, and returns false on failure and generates an E_ WARNING level error. After the @ symbol is used in front of filesize(), no E will appear on the page_ Warning error prompt.

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