Types of Errors In PHP

03-Apr-2023

.

Admin

Types of Errors In PHP

Hi Dev,

This tutorial is focused on types of errors in PHP. you'll learn how many types of errors are in PHP. We will use error types in PHP. if you have a question about how many types of errors in PHP then I will give a simple example with a solution.

Now, let's see the article on how many types of errors in PHP. it's a simple example of error types in PHP. you can understand the concept of how many types of errors are in PHP. if you have a question about the types of errors in PHP then I will give a simple example with a solution.

Notice Error


When trying to access the undefined variable in the PHP script at that time notice error occurs. Notice error does not stop the execution of the PHP script. It only notice you that there is a problem.

<?php

$a="A variable";

echo $a;

echo $b;

?>

Warning Error

The main reason to occurs warning errors is to include a missing file, or call a function with incorrect parameters. It is similar to noticing an error, it also does not stop the execution of the PHP script. It only reminds you that there is a problem in the script.

<?php

echo "Warning error"';

include ("external_file.php");

?>

Fatal Error

If you call the undefined function or class in the script is the main reason to occurs fatal error.

<?php

function addition(){

$a = 10;

$b = 50;

$c = $a + $b;

echo "Addition of a + b = ".$c;

}

addition();

sub();

?>

Parse Error

The parse error happens, when a syntax is mistyped in the script. Parse error also stops the execution of the PHP script and it displays an error message.

<?php

echo "1";

echo "2"

echo "3";

?>

I hope it could help you...

#PHP