Whats the difference between include() and require()?
Answers were Sorted based on User's Feedback
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 |
Answer / mahidhar
include() produces a Warning message where as require()
gives Fatal Error.
| Is This Answer Correct ? | 8 Yes | 3 No |
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 |
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 |
How to receive a cookie from the browser?
What is cookies php?
What is the difference between associative array and indexed array?
What is restful api?
Does php need a closing tag?
Explain what are the different errors in php?
How to connect SMTP server in php. I want to edit that in mantiss bug tracking tool. If anyone worked on mantiss software or in php, please give answer . I need to modify that in mantiss software.
What is form submission?
What is meant by pdo in php?
Which function is used in php to search a particular value in an array?
What is global array in php?
What is the difference between apache and tomcat?