Whats the difference between include() and require()?

Answers were Sorted based on User's Feedback



Whats the difference between include() and require()?..

Answer / kathiresan n

You can insert the content of a file into a PHP file before
the server executes it, with the include() or require()
function.
The two functions are identical in every way, except how
they handle errors.
The include() function generates a warning but the script
will continue execution while the require() function
generates a fatal error and the script execution will stop
after the error.

Is This Answer Correct ?    9 Yes 0 No

Whats the difference between include() and require()?..

Answer / mahidhar

include() produces a Warning message where as require()
gives Fatal Error.

Is This Answer Correct ?    8 Yes 3 No

Whats the difference between include() and require()?..

Answer / priyanka

include() function generates a warning but the script
will continue execution while the require() function
generates a fatal error and the script execution will stop
after the error.

Is This Answer Correct ?    1 Yes 0 No

Whats the difference between include() and require()?..

Answer / shanawar

Both used for connecting to the database. but the main
difference b/w them if we r using include()and the file is
not found then a warring will be occure and script will be
execute.. But in the case of require() a error will occure
and script will be helt........................ Shanawar

Is This Answer Correct ?    1 Yes 12 No

Post New Answer

More PHP Interview Questions

how to extract month from given date by using string functions?

3 Answers  


If we login more than one browser windows at the same time with same user and after that we close one window, then is the session is exist to other windows or not? And if yes then why? If no then why?

0 Answers  


How many types of php are there?

0 Answers  


What is difference between html and php?

0 Answers  


How to convert a string to uppercase in php?

0 Answers  






Do you know what is the use of rand() in php?

0 Answers  


What are the different ways to login to a remote server?

0 Answers  


How do you destroy a session?

0 Answers  


What is difference between action hook and filter hook?

0 Answers  


Write a program in php to reverse a number?

0 Answers  


What is the functionality of the function strstr and stristr?

2 Answers  


Why php is used?

0 Answers  


Categories