Error_reporting (e_all ^ e_notice ^ e_strict ^ e_deprecated);
Guys, help me explain what this line of code is aware of, set what error level,
Reply content:
Error_reporting (e_all ^ e_notice ^ e_strict ^ e_deprecated);
Guys, help me explain what this line of code is aware of, set what error level,
Check out the official PHP documentation to know: error_reporting
The above code means that 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, the corresponding binary is roughly the following
E_NOTICE 00001 E_STRICT 00010E_DEPRECATED 00100E_ALL 11111
After doing the XOR or operation, the equivalent is to change the same into 0 different into 1 that is to say the result is that the e_all excluded the different or operation of the few.
The above constants correspond to the value of purely fictitious, can try to print out to see exactly how much.
Similarly, you can use E_notice | E_strict such a way to set multiple levels for reporting. The principle is that after the operation or manipulation there are 1 1, all 0 0
What is represented here is that it outputs all types of errors (E_all), but excludes E_notice, e_strict, e_deprecated, and other types of errors.
Here is a bit arithmetic technique, because E_all is a full 1 number, and E_notice, E_strict, and e_deprecated are all 1 numbers, these different or a few, forming a log level to exclude these several.