What are the differences between require and include,
include_once?

Answer Posted / ashwini

All three include(),include_once() and require() are used to
an include file into the current page.

If the file is not present, require(), calls a fatal error,
while in include() does not.

The include_once() statement includes and evaluates the
specified file during the execution of the script. This is a
behavior similar to the include() statement, with the only
difference being that if the code from a file has already
been included, it will not be included again. It does not
call a fatal error if file not exists. require_once() does
the same as include_once(), but it calls a fatal error if
file not exists.

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is the use of "echo" in php?

554


How do you check is php not empty?

548


What are the differences between GET and POST methods?

530


Is false empty php?

548


What are some new features introduced in php7?

8376






Which is the best web server?

531


Explain the advantages of using PHP?

551


What is a controller in programming?

494


What is the function in PHP do not return a timestamp?

564


Does php support inheritance?

503


How is it possible to return a value from a function?

542


What is isset php?

521


Explain how we can get the number of elements in an array?

518


What is namespace and use in php?

522


How can we create a database using php?

595