code.youlikeshare.com

Suppress error with PHP error control operator (the @ symbol)

PHP supports one error control operator - the @ symbol. When prepended to an expression in PHP, any error messages that might be generated by that expression will be ignored.

For example,
Without error control operator
$result = file_get_contents("invalid_path");
It will returns error as below:
Warning: file_get_contents(invalid_path): failed to open stream: No such file or directory in [path] on line [line_number]
With prepended error control operator
$result = @file_get_contents("invalid_path") or die("file not found!");
It will returns error as below:
file not found!