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

Is java is better than php?

549


Are php sessions secure?

529


What language is php written in?

583


Tell me which programming language does php resemble to?

501


What are computer variables?

528






What is the php function that removes the last element of the array and returns it?

506


What is json php?

529


Is laravel an oop?

507


Tell me how do I escape data before storing it into the database?

525


How to Pass JSON Data in a URL using CURL in PHP?

561


What are static variables in php?

505


What is cakephp framework?

529


What websites use php?

517


Does https prevent csrf?

516


What is the use of mvc in php?

511