When I looked at the connect.php of Empire cms, I found that the first sentence is error_reporting(E_ALL ^ E_NOTICE); I have never noticed this statement before. I know that it sets an error prompt, but I don’t know how. Set to use. Below I have excerpted some things from the Internet and summarized them.
Example:
Under Windows environment: The program that was originally running normally in php4.3.0 is reporting multiple errors in 4.3.1. The general prompt is: : Notice: Undefined varialbe: variable name.
For example, the following code:
The code is as follows:
if (!$tmp_i) { $tmp_i=10; }
It runs normally in 4.3.0 and in 4.3.1 When running, it will prompt Notice:Undefined varialbe:tmp_i
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:
Add a sentence at the beginning of the program:
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 up the numbers 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 caused by bugs in your code,
; may also be caused by intentional behavior. (For example: automatic initialization of an uninitialized variable to a
;The fact that an empty string is using an uninitialized variable)
; E_CORE_ERROR - Fatal error that occurs during the initialization process when PHP is started
; E_CORE_WARNING - Occurs when PHP is started Warning during initialization (non-fatal error)
; E_COMPILE_ERROR - Fatal error during compilation
; E_COMPILE_WARNING - Warning during compilation (non-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 errors except E_WARNING E_NOTICE Information
error_reporting(E_ERROR | E_WARNING | E_PARSE);//Display runtime errors, which has the same effect as error_reporting(E_ALL ^ E_NOTICE); error_reporting(E_ALL);//Display all errors
The following is a detailed explanation of the function of PHP error_reporting() error control function
Definition and usage:
error_reporting() sets the error level of PHP and returns the current level # #.
##Function syntax:error_reporting(report_level)If the parameter level is not specified, the current error level will be returned. The following items are possible values of level: Value constant description1 E_ERROR Fatal
Running error. The error cannot be recovered and execution of the script is suspended.
2 E_WARNING Runtime warning (non-fatal error). Non-fatal runtime error, script execution will not stop. 4 E_PARSE compile-time parsing error. Parsing errors are generated only by the parser. 8 E_NOTICE Runtime reminder (These are often caused by bugs in your code, or may be caused by intentional behavior.) 16 E_CORE_ERROR Fatal error during initialization process when PHP starts . 32 E_CORE_WARNING Warning (non-fatal error) during the initialization process when PHP starts. 64 E_COMPILE_ERROR Fatal error during compilation. This is like an E_ERROR being generated by the Zend scripting engine. 128 E_COMPILE_WARNING compile-time warning (non-fatal error). This is like an E_WARNING warning generated by the Zend script engine. 256 E_USER_ERROR User-defined error message. This is like a user-defined warning message by using the PHP functiontrigger_error (Programmer sets E_ERROR)
512 E_USER_WARNING. This is like a user-defined reminder message using the PHP function trigger_error (an E_WARNING warning set by the programmer) 1024 E_USER_NOTICE. This is like a standardized warning encoded by 2048 E_STRICT using the PHP function trigger_error (an E_NOTICE set by the programmer). Allows PHP to suggest how to modify the code to ensure optimal interoperability and forward compatibility.4096 E_RECOVERABLE_ERROR Fatal error in capturing. This is like an E_ERROR, but can be caught by a user-defined handler (see also set_error_handler())
8191 E_ALL All errors and warnings (excluding E_STRICT) (E_STRICT will be part of E_ALL as of PHP 6.0)
The above is the detailed content of Detailed description of php error_reporting() function. For more information, please follow other related articles on the PHP Chinese website!

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

In PHP, use the clone keyword to create a copy of the object and customize the cloning behavior through the \_\_clone magic method. 1. Use the clone keyword to make a shallow copy, cloning the object's properties but not the object's properties. 2. The \_\_clone method can deeply copy nested objects to avoid shallow copying problems. 3. Pay attention to avoid circular references and performance problems in cloning, and optimize cloning operations to improve efficiency.

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Notepad++7.3.1
Easy-to-use and free code editor