Expressions And Operators: Error Control

The operator @ suppresses any error messages generated by the evaluation of the expression that follows it. For example:

$infile = @fopen("NoSuchFile.txt", 'r');

On open failure, the value returned by fopen is false, which you can use to handle the error. There is no need to have any error message displayed.

If a custom error-handler has been established using the library function set_error_handler that handler is still called.

This syntax can be disabled with the disallow_silence option in .hhconfig.

Was This Page Useful?
Thank You!
Thank You! If you'd like to share more feedback, please file an issue.