Error management operator tutorial

In PHP, there is an error control operator (it is also called an error suppression operator). If you add the symbol @, then a message about any error (note, warning) that can be generated as a result of its operation will be ignored.

For example, if you refer to a non-existent array element, (under normal conditions), you get the result Notice: Undefined index . If you write this operator before accessing a non-existent array element, the message will not be displayed.

Also, this operator can be written before the function is called (more about functions in the following lessons). Then, if an error occurs during the operation of the function, the message will be ignored. In this example, functions errorFunction the not declared function is called some_function

function errorFunction()

echo 1;

This isfatal error, but we will not see any messages about it. But the script will still be stopped and the instruction echo 1 will not be performed.

Замечание . It is not recommended to use this operator without urgent need, since it will hide messages about potential problems in the program.