What is the exact Diff. between include_once() and
require_once() in PHP?

Answer Posted / arvind pippal

. 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. As
the name suggests, it will be included just once.
include_once() should be used in cases where the same file
might be included and evaluatedmore than once during a
particularexecution of a script, and you want to be sure
that it is included exactly once to avoid problems with
function redefinitions, variable value reassignments, etc.
require_once() should be used in cases where the same file
might be included and evaluatedmore than once during a
particular execution of a script, and you want to be sure
that it is included exactly once to avoid problems with
function redefinitions, variable value reassignments, etc.

Is This Answer Correct ?    50 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a simple php method to make a cross domain data request?

708


What is ci framework in php?

680


Define urlencode() and urldecode() used in php?

803


What is the function of trim?

708


What is different types of visibility?

701


When to use single quotes, double quotes, and backticks?

727


What is curl php?

708


What's the best method for sanitizing user input with php?

680


What is php rest api?

754


Does exist in php?

731


What is escape data in php?

694


Is php pass by reference or value?

746


What is constructor and destructor?

720


What is difference between echo and print in php?

693


How is the comparison of objects done in php?

695