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 the difference between nowdoc and heredoc?

744


Suppose the variable $var1 is set to 10 and the $var2 is set to the character var1, what's the value of $$var2?

745


Tell me what is the use of "enctype" attribute in a html form?

791


How we load all classes that placed in different directory in one php file , means how to do auto load classes.

741


What does it mean when it says the csrf token is invalid?

693


How do you identify independent and dependent variables in regression analysis?

713


Write a program to display table of a number using php?

688


How can you send http header to the client in php?

719


How to read a file in php?

729


What is session and Cokkies . How it works . tell some thing about Session_id()

1746


How to remove white spaces from the beginning and/or the end of a string in php?

767


What is if isset ($_ post submit )) in php?

746


Tell me how to execute an sql query? How to fetch its result?

774


What does $_files means?

739


What type of headers that PHP supports?

815