PHP has 11 error levels ranging from fatal errors to user-defined errors. Different error levels help distinguish the severity of errors, assisting developers in precise debugging and handling.
Fatal errors that immediately stop script execution and display an error message. Common cases include syntax errors or calling undefined functions or classes.
Serious errors that do not halt script execution. For example, accessing undefined variables or type mismatches in function parameters will trigger warnings.
Non-fatal runtime errors, usually for development purposes. Examples include unused variables or unclosed HTML tags.
Errors in strict mode, used to enforce code standards and optimization. Only triggered when strict mode is enabled, such as undeclared variables or extra semicolons.
Fatal errors that can be caught and handled using user-defined error handling functions, preventing script termination.
Indicates deprecated features or code. Developers are recommended to update or replace them promptly.
Core errors of the PHP engine, usually preventing the system from running. Examples include memory allocation failure or failed extension loading.
Fatal errors occurring during compilation, such as parsing errors or missing required files, stopping script execution.
User-defined fatal errors, triggered manually using the trigger_error() function.
User-defined non-fatal warnings, also triggered using trigger_error().
User-defined runtime notices, used to alert developers to specific code behavior.
Understanding PHP error levels helps developers debug programs more effectively and improve code quality. Properly handling different types of errors ensures applications run more stably and reliably in both development and production environments.