Introduction
An error is a type of mistake. We can say an error is a condition of having incorrect or false knowledge or an error is defined as an unexpected, invalid program state from which it is impossible to recover.
Error can also be defined as "a deviation from accuracy or correctness". A "mistake" is an error caused by a fault: the fault being misjudgment, carelessness, or forgetfulness. An error message with filename, line number and a message describing the error is sent to the browser.
Types of error
Basically there are four types of errors in PHP, which are as follows:
- Parse Error (Syntax Error)
- Fatal Error
- Warning Error
- Notice Error
1. Parse Errors (syntax errors)
The parse error occurs if there is a syntax mistake in the script; the output is Parse errors. A parse error stops the execution of the script. There are many reasons for the occurrence of parse errors in PHP. The common reasons for parse errors are as follows:
Common reason of syntax errors are:
- Unclosed quotes
- Missing or Extra parentheses
- Unclosed braces
- Missing semicolon
Example
<?php
echo "Cat";
echo "Dog"
echo "Lion";
?>
Output
In the above code we missed the semicolon in the second line. When that happens there will be a parse or syntax error which stops execution of the script, as in the following image:

2. 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. If you are trying to access the undefined functions, then the output is a fatal error.
Example
<?php
function fun1()
{
echo "Vineet Saini";
}
fun2();
echo "Fatal Error !!";
?>




vikrant chaudharyPosted Dec 8, 2017, 11:21 PM
Good, I am a Sunderdeep student too from Computer Science but I have open a Production house with a name "MedLion Production" for Music, Videos, 3D model videos, 2D videos, Portfolio, Sound, Digital Advertisement, Holograms and much more.
SubashPosted Sep 19, 2016, 8:16 AM
Good
Atif QureshiPosted Mar 18, 2016, 12:15 PM
It is a well written article. You may learn details of types of errors also at http://ictdesignhub.com/php/types-of-errors-in-php/