PHP supports one error control operator: the at sign (@). When
prepended to an expression in PHP, any error messages that might
be generated by that expression will be ignored.
If the track_errors
feature is enabled, any error message generated by the expression
will be saved in the variable
$php_errormsg.
This variable will be overwritten on each error, so check early if you
want to use it.
<?php /* Intentional file error */ $my_file = @file ('non_existent_file') or die ("Failed opening file: error was '$php_errormsg'");
// this works for any expression, not just functions: $value = @$cache[$key]; // will not issue a notice if the index $key doesn't exist.
?>
Note:
The @-operator works only on
expressions. A simple rule
of thumb is: if you can take the value of something, you can prepend
the @ operator to it. For instance, you can prepend it to variables,
function and include() calls, constants, and
so forth. You cannot prepend it to function or class definitions,
or conditional structures such as if and
foreach, and so forth.
Note:
The "@" error-control operator prefix will not disable messages
that are the result of parse errors.
Warning
Currently the "@" error-control operator prefix will even disable
error reporting for critical errors that will terminate script
execution. Among other things, this means that if you use "@" to
suppress errors from a certain function and either it isn't
available or has been mistyped, the script will die right there
with no indication as to why.
Php language.operators.errorcontrol Function syntax tag
language.operators.errorcontrol php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online
php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.