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 session and why do we use it?

656


What is the scope of a variable defined outside a function?

607


Do you know what is the differences between $a != $B and $a !== $B?

573


What is PHP? Who is the father or inventor of PHP?

696


How can we change the maximum size of the files to be uploaded?

605






What is the function mysql_pconnect() usefull for?

624


Tell me what is the difference between ereg_replace() and eregi_replace()?

622


Tell me how can we determine whether a variable is set?

580


Can we use get instead of post?

580


What do you mean by core php?

572


How do you create an array in php?

615


Is array function in php?

608


What is the basic syntax of Php?

703


What is final keyword in php?

626


A process can run only in the background. State Whether True or False?

711