Introduction

  • Error is one of the major hindrances in the programming world.
  • The error is generated in the program mainly due to incorrect or partial/incomplete knowledge of programming languages syntax. 

Definition

  • An error is one or more faults or mistakes in a Php program that may be caused by writing incorrect syntax or incorrect code or incorrect logic.

Type of Errors

  • There are the following types of errors in Php –
  • Fatal Error:
    • A fatal error is one of the main Php errors, which is occurred due to the use of the undefined function.
    • In this type of error, the Php compiler when executes a function having no definition, then the Php compiler generates a fatal error.
    • This error stops the program execution when generated.
  • Syntax/Parse Error:
    • It is one of the major types of errors generated in a Php program.
    • This error is generated mainly due to the presence of incorrect syntax in the program/source code.
    • This error is detected by the Php Compiler during the compilation of the source code (=compile time).
    • The common syntax errors are unclosed quotes, missing semicolons, extra or missing parentheses, or unclosed brackets, and many more.
    • When a program generates a syntax error, it normally gives a parse error or syntax error message and finally stops the program.
  • Warning:
    • Normally a warning error is generated when the programmer uses to include a non-exist file and passes an incorrect number of parameters to a Php function in the program. During the execution of the program, the Php calls that missing file that does not exist or searches for the correct parameter values, and hence warning message arises.
    • The warning error does not stop/prevent the execution of the program but rather continues the execution of the program with a warning error message.
  • Notice
    • Notice error usually occurs when a programmer tries to use or access a variable that is undefined in that program.
    • On the generation of notice, the error does not prevent/affect the execution of the code but rather continues the execution of the program even after the finding of a notice error.

Loading

Categories: Php Theory

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.