The Eduladder is a community of students, teachers, and programmers just interested to make you pass any exams. So we help you to solve your academic and programming questions fast.
In eduladder you can Ask,Answer,Listen,Earn and Download Questions and Question papers.
Watch related videos of your favorite subject.
Connect with students from different parts of the world.
Apply or Post Jobs, Courses ,Internships and Volunteering opportunity. For FREE
See Our team
Wondering how we keep quality?
Got unsolved questions? Ask Questions

PHP-interview-questions-basic-->View question

What are the different types of errors in PHP?

its about What are the different types of errors in PHP

Asked On2019-10-22 02:52:26 by:Annaliya

Taged users:

Be first to like this question

Be first to dislike this question
Talk about this  Like  Dislike
View all qusetions

Error is the fault or mistake in a program. It can be several types. Error can occur due to wrong syntax or wrong logic. It is a type of mistakes or condition of having incorrect knowledge of the code.

There are various types of errors in PHP but it contains basically four main type of errors.

1.       Parse error or Syntax Error: It is the type of error done by the programmer in the source code of the program. The syntax error is caught by the compiler. After fixing the syntax error the compiler compile the code and execute it. Parse errors can be caused dues to unclosed quotes, missing or Extra parentheses, Unclosed braces, Missing semicolon etc



$x = "geeks";

y = "Computer science";

echo $x;

echo $y;



PHP Parse error:  syntax error, unexpected '='

in /home/18cb2875ac563160a6120819bab084c8.php on line 3

Explanation: In above program, $ sign is missing in line 3 so it gives an error message.

2.       Fatal Error: It is the type of error where PHP compiler understand the PHP code but it recognizes an undeclared function. This means that function is called without the definition of function.




function add($x, $y)


    $sum = $x + $y;

    echo "sum = " . $sum;


$x = 0;

$y = 20;

add($x, $y);


diff($x, $y);



PHP Fatal error:  Uncaught Error:

Call to undefined function diff()

in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php:12


Stack trace:

#0 {main}

  thrown in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php on line 12

Explanation : In line 12, function is called but the definition of function is not available. So it gives error.

3.       Warning Errors : The main reason of warning errors are including a missing file. This means that the PHP function call the missing file.




$x = "GeeksforGeeks";


include ("gfg.php");


echo $x . "Computer science portal";



PHP Warning:  include(gfg.php): failed to

open stream: No such file or directory in

/home/aed0ed3b35fece41022f332aba5c9b45.php on line 5

PHP Warning:  include(): Failed opening 'gfg.php'

 for inclusion (include_path='.:/usr/share/php') in

/home/aed0ed3b35fece41022f332aba5c9b45.php on line 5

Explanation: This program call an undefined file gfg.php which are not available. So it produces error.

4.       Notice Error: It is similar to warning error. It means that the program contains something wrong but it allows the execution of script.




$x = "GeeksforGeeks";


echo $x;


echo $geeks;



PHP Notice:  Undefined variable: geeks in

/home/84c47fe936e1068b69fb834508d59689.php on line 5



Explanation: This program use undeclared variable $geeks so it gives error message.


Answerd on:2019-09-07 Answerd By:Tanisha-Garg

Be first to like this answer

Be first to dislike this answer
Talk about this  Like  Dislike

You might like this video:Watch more here

Watch more videos from this user Here

Learn how to upload a video over here

Lets together make the web is a better place

We made eduladder by keeping the ideology of building a supermarket of all the educational material available under one roof. We are doing it with the help of individual contributors like you, interns and employees. So the resources you are looking for can be easily available and accessible also with the freedom of remix reuse and reshare our content under the terms of creative commons license with attribution required close.

You can also contribute to our vision of "Helping student to pass any exams" with these.
Answer a question: You can answer the questions not yet answered in eduladder.How to answer a question
Career: Work or do your internship with us.Work with us
Create a video: You can teach anything and everything each video should be less than five minutes should cover the idea less than five min.How to upload a video on eduladder