error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT ^ E_DEPRECATED);
Brothers, help me explain what this line of code means and what error level to set,
error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT ^ E_DEPRECATED);
Brothers, help me explain what this line of code means and what error level to set,
Check the official PHP documentation to know: error_reporting
The above code means: all errors except E_NOTICE E_SCRICT E_DEPRECATED are reported.
E_ALL ^ E_NOTICE ^ E_STRICT ^ E_DEPRECATED This is a continuous XOR operation.
E_ALL E_NOTICE E_STRICT E_DEPRECATED These are constants, and the corresponding binary numbers are roughly as follows
<code>E_NOTICE 00001 E_STRICT 00010 E_DEPRECATED 00100 E_ALL 11111 </code>
After performing the XOR operation, it is equivalent to turning the same ones into 0 and the different ones into 1. In other words, the result obtained is that E_ALL excludes those that perform the XOR operation.
The values corresponding to the above constants are purely fictitious. You can try to print them out to see what they are.
Similarly, you can also use methods such as E_NOTICE | E_STRICT to set multiple levels for reporting. The principle is that after the or operation, if there is 1, it is 1, and if there are all 0, it is 0
What this means is: output all types of errors (E_ALL), but exclude E_NOTICE, E_STRICT, and E_DEPRECATED.
A bit operation technique is used here, because E_ALL is an all-1 number, and E_NOTICE, E_STRICT, and E_DEPRECATED are all single-1 numbers. These are XORed to form a log-level number that excludes these items. .