nortonpartitionmagic PHP function error_reportingE_ALL ^ ​​E_NOTICE detailed description

WBOY
Release: 2016-07-29 08:45:54
Original
1000 people have browsed it

For example:
In Windows environment: a program that originally ran normally in php4.3.0, why are there many errors reported in 4.3.1? The general prompt is: Notice: Undefined varialbe: variable name.
For example, the following code:

Copy the code The code is as follows:


if (!$tmp_i) {
$tmp_i=10;
}


runs normally in 4.3.0, but will prompt Notice: Undefined when running in 4.3.1 varialbe:tmp_i
The following questions:
1. Where is the problem?
2. How should this code be modified?
3. Without changing the code, how to modify the settings in php.ini so that the original program in 4.3.0 can run normally in the 4.3.1 environment? This error message will not appear.
Solution:
At the beginning of the program Add a sentence:
error_reporting(E_ALL & ~E_NOTICE); or error_reporting(E_ALL ^ ​​E_NOTICE);
or
modify php.ini
error_reporting = E_ALL & ~E_NOTICE
About the error_reporting() function:
error_reporting() sets the error level of PHP and returns the current level.
; Error reporting is bitwise. Or add the numbers together to get the desired error reporting level.
; E_ALL - all errors and warnings
; E_ERROR - fatal runtime errors
; E_WARNING - runtime warnings (non-fatal errors)
; E_PARSE - compile-time parsing errors
; E_NOTICE - runtime reminders (these are often It's caused by a bug in your code, or it could be caused by intentional behavior (such as using an uninitialized variable based on the fact that it is automatically initialized to an empty string)
; E_CORE_ERROR. - Fatal error that occurs during the initialization process of PHP startup
; E_CORE_WARNING - Warning (non-fatal error) that occurs during the initialization process of PHP startup
; E_COMPILE_ERROR - Fatal error at compile time
; E_COMPILE_WARNING - Compile time warning (non-fatal error) Fatal error)
; E_USER_ERROR - user-generated error message
; E_USER_WARNING - user-generated warning message
; E_USER_NOTICE - user-generated reminder message
Usage:
error_reporting(0);//Disable error reporting
error_reporting(E_ALL ^ E_NOTICE);//Display all error messages except E_NOTICE
error_reporting(E_ALL^E_WARNING^E_NOTICE);//Display all error messages except E_WARNING E_NOTICE
error_reporting(E_ERROR | E_WARNING | E_PARSE);//Display Runtime error, same effect as error_reporting(E_ALL ^ ​​E_NOTICE); error_reporting(E_ALL);//Display all errors.
The above introduces the detailed description of error_reportingE_ALL ^ ​​E_NOTICE of nortonpartitionmagic PHP function, including the content of nortonpartitionmagic. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template