Types of Error in PHP


What is an Error in PHP?
An error is a type of mistake, in another words we can say that error is a condition of having incorrect false knowledge or it is defined as an unexpected.
and Mistake is an error caused by a fault.

Types of error
  1. Parse Error or Syntax Error
  2. Fatal Error
  3. Warning Error
  4. Notice Error
  1. Parse Errors (syntax errors) :                                                              It will occur when there is a syntax mistake in the script.
     Following are the reason of syntax errors:
  • Unclosed quotes
  • Missing or Extra parentheses
  • Unclosed braces 
  • Missing semicolon
Example
<?php
echo "Correct syntax";
echo "synatx Error"
echo "Synatx Error":
?>

 2  Fatal Errors
It will occur when PHP couldn’t understand what you've written. It stop the execution of the script.
       Example
<?php
function fun1(){
echo "Hello PHP";
}
fun2();
echo "Fatal Error !!";
?>

     3. Warning Errors
 It will occur when the file is missing or incorrect number of parameter . It   doesn’t stop the execution of script.
<?php echo "Warning Error!!";
include ("index.php");
?>

 4. Notice Errors
  It will occur when you have not declare variable. It is same as warning error i.e.
          <?php
           $a="Hello PHP";
           echo "Notice Error !!";
           echo $b;
           ?>


agyanadda

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 $type={blogger}:

Post a Comment