PHP supports the error control operator i.e. the at sign (@). When @ is prepended to an expression, any error messages that might be generated by that expression gets ignored.
To use @ symbol in PHP, the code is as follows−
Example
<?php $file = @file ('non_existent_file') or die ("Failed in opening the file: Error Message = '$err'"); $value = @$cache[$key]; ?>
Output
This will produce the following output−
Failed in opening the file: Error Message = ''PHP Notice: Undefined variable: err in /home/cg/root/6985034/main.php on line 4
Example
Let us now see another example−
<?php $val = $test['5'] $val = @$test['5'] ?>
Output
This will produce the following output−
PHP Parse error: syntax error, unexpected '$val' (T_VARIABLE) in /home/cg/root/6985034/main.php on line 5