Menu
Coddy logo textTech

Understanding PHP Errors

Part of the Logic & Flow section of Coddy's PHP journey — lesson 52 of 68.

When you write PHP code, things don't always go as planned. PHP has a built-in system for reporting different types of problems that can occur in your code. Understanding these error types helps you identify what went wrong and how serious the problem is.

Notices are the mildest type of error. They indicate potential issues that don't stop your script from running, such as using an undefined variable. Your code continues to execute, but PHP warns you about something that might cause problems later.

Warnings are more serious than notices but still allow your script to continue running. These occur when PHP encounters a problem like trying to include a file that doesn't exist or calling a function with the wrong number of arguments. The script keeps going, but the problematic operation fails.

Fatal Errors are the most severe type and immediately stop your script from executing. These happen when PHP encounters something it cannot recover from, such as calling a function that doesn't exist or running out of memory. When a fatal error occurs, your script stops completely at that point.

Learning to recognize these different error types in PHP's error messages will help you quickly understand the severity of problems in your code and respond appropriately to fix them.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

Cheat sheet

PHP has three main error types that indicate different levels of severity:

Notices - Mildest errors that don't stop script execution. Warn about potential issues like undefined variables.

Warnings - More serious than notices but script continues running. Occur when operations fail, like including non-existent files or calling functions with wrong arguments.

Fatal Errors - Most severe errors that immediately stop script execution. Happen when PHP encounters unrecoverable problems like calling non-existent functions or running out of memory.

Try it yourself

This lesson doesn't include a code challenge.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Logic & Flow