How Many Types of Error in PHP?

PHP has four types of error which are defined as below with definitions:-

Notice:-

Notice error means when a variable that not yet been defined then shows Notice error in PHP. These are non-critical errors, that PHP encounters while executing a script, for example, accessing. It is similar to a warning error. It means that the program has something wrong but it allows the execution of the script.

Warnings:-

The main reason of warning errors are including a missing file. This means that the PHP function calls the missing file. These are more serious errors – for example, attempting to include() a file that does not exist. By default, these errors are displayed to the users, but they do not result in script termination.

Fatal errors:-

Fatal errors are caused when PHP understands what you’ve written, however, what you’re asking it to do can’t be done. Fatal errors stop the execution of the script. These are critical errors- for example, an object of a non-existent class, or calling a non-existent function.

Parse error or Syntax Error:-

If there are syntax errors in PHP means Parse Error. It is the type of error done by the programmer in the source code of the program. The syntax error is caught by the compiler. After fixing the syntax error the compiler compiles the code and executes it. Parse errors can be caused dues to enclosed quotes, missing or Extra parentheses, Enclosed braces, Missing semicolon, etc.

Rajesh Kumar
Follow me