Connect with us

Hi, what are you looking for?

Tech BableTech Bable


What are the four different types of PHP errors?



When an error develops in PHP, it is referred to as a PHP Error. Whether it’s a missing semicolon or the erroneous variable being called, the issue can be very simple or quite complex.

You need to know what kind of problem is happening in a PHP script before you can fix it effectively.

PHP programmers occasionally see this utilized stat method and are unsure of the cause How to fix “The useState set method not reflecting a change immediately”?

The following four sorts of PHP errors:

  1. Fatal Error
  2. Warning Error
  3. Parse Error
  4. Notice Error

Fatal Error

Critical errors are ones that cause your software to become unresponsive and are referred to as fatal errors. The most common cause of errors of this kind is the presence in the script of an undefined function or class.

There are three categories of mistakes that might have catastrophic consequences:

  1. Error fatal at startup (occurring when the system is unable to run the code after installation)
  2. Compile time fatal error (when a programmer tries to use nonexistent data)
  3. Runtime fatal error (happens while the program is running, causing the code to stop working completely)

For example, attempting to run the following script will end in a disastrous failure:



function sub()



echo “The sub= “.$sub;





Warning Error

The script will continue to run even if it encounters a warning error in PHP. It does little more than alert you to the fact that there is a problem, one that is likely to lead to more significant problems in the future.

The following are the most prevalent reasons for warning errors:

  1. Invoking the existence of an external file that is not present in the directory
  2. Incorrect values entered into a function’s parameters

Take, for example:


echo “Warning error”‘;

include (“external_file.php”);



Parse Error

Incorrect use of a symbol or the absence of a symbol in syntax might lead to a parse error. The problem is detected by the compiler, which then stops the script from running.

Errors in parsing can be brought on by:

  • brackets or quotations that aren’t completely closed
  • a lack of or an excessive number of semicolons or parentheses 
  • Misspellings

The following script, for instance, would cause the execution to halt and would raise a parsing error:



cho “Red”;

echo “Blue”;

echo “Green”


Notice Error

Errors in the notice are considered minor errors. They are comparable to errors that serve as warnings in that the execution of the code is not halted. The majority of the time, the system is unable to determine whether or not it is a true error or simply typical code. Scripts frequently run into problems when they attempt to access variables that have not been defined.




$a=”Defined error”;

echo “Notice error”;

echo $b;


Final Words

Learning the distinctions between the four distinct sorts of PHP errors might assist you in rapidly locating and resolving issues that have arisen within your script. It is imperative that you pay close attention to the output messages since they frequently reflect on further problems or cautions. 

If you are looking for a defect on your website, knowing the version of PHP that your web server is using is an additional piece of information that can be helpful.

Thanks For Reading
More Read On Tech Bable 

Click to comment

Leave a Reply

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

You May Also Like

Science & Technology

170+ Windows 11 Keyboard shortcuts to make your Windows 11 experience faster and more productive. Windows 11 has added some new keyboard shortcut keys...


Google Pixelbook 12in is the latest Chromebook invention with advanced features and an elegant appearance. Chromebooks are different from older PCs and laptops. They...


The Alienware Aurora is an excellent midrange gaming laptop, with a side-mounted panel that allows for easy access to all components. The Alienware Aurora 2019...


Contents1 Introduction2 Design and Build Quality3 Hardware and Performance4 Productivity Features5 Multimedia and Entertainment6 Conclusion Introduction The Google Pixel Slate M3 is a 2-in-1...