Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / devendrarjadav

If the file specified with include_once() is not exist then
system displays warning where in the case of require_once()
system displays Fatal error in the client browsers window.

Is This Answer Correct ?    51 Yes 27 No

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

Answer / umapathi

include_once -it file is not exist it displays warning
message
in case of require_once-if the file is not exist it
displays fatal error

Is This Answer Correct ?    34 Yes 18 No

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

Answer / rahul anand

when we use require_once then if the file is not existed
then it will show the fetal error and will not execute the
instruction written under the require_once function. In the
case of include_once() if the file does not exist then it
will show the error message and also show the statements
written under the include_once function.

Is This Answer Correct ?    16 Yes 11 No

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

Answer / vineet kumar saini

1.include() includes a file in memory no matter if it has
already been loaded
2.include_once() includes a file in memory only if it has
not been loaded already
3.require() includes a file in memory no matter if it has
already been loaded. if the file cannot be loaded, the
script is aborted
4.require_once() does the same as require(), but only if the
file hasn't been included yet. if the file's already in
memory, it has no effect.

Is This Answer Correct ?    1 Yes 0 No

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

Answer / basha

include_once -it file is not exist it displays warning
message and continue the program

in case of require_once-if the file is not exist it
displays fatal error and terminate the prgram

Is This Answer Correct ?    21 Yes 21 No

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

Answer / senthil

in include_once display the warning message if the
containing file is not exist but require_once function
could not diplay the warning message it's a FATAL ERRor in
that time ...

Is This Answer Correct ?    4 Yes 4 No

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

Answer / izhar aazmi

Include => Include the said file during execution...
Require => Require the said file for the execution...

As in english "require" mandatory inclusion is expected and
hence, on failure execution shall halt with fatal error...

Is This Answer Correct ?    0 Yes 0 No

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

Answer / kedar haldikar

If the file specified with include_once() is not exist then
system displays warning where in the case of require_once()
system displays Fatal error in the client browsers window.

Is This Answer Correct ?    4 Yes 9 No

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

Answer / maish

both include external file accept

there is failer i smajor difference
in inclde give warning after failure and in requre
give fatal error stop execution file

Is This Answer Correct ?    6 Yes 13 No

Post New Answer

More PHP Interview Questions

What is polymorphism?

0 Answers  


Tell me how can we display information of a variable and readable by human with php?

0 Answers  


What is composer used for?

0 Answers  


How come the code works, but doesn’t for two-dimensional array of mine?

0 Answers  


How many records can be stored in mysql table?

0 Answers  


what type of images that the PHP version supports

4 Answers  


What is the functionality of the functions strstr() and stristr()?

0 Answers  


If we login more than one browser windows at the same time with same user and after that we close one window, then is the session is exist to other windows or not? And if yes then why? If no then why?

0 Answers  


If i make my selection in State Dropdown list, i would the City and ZipCode dropdown list to be automatically reupdated based on the State i select.(This to avoid the user select a City or Zipcode that does not correspond to the State previously selected.)

2 Answers   CMC, PHP,


What are the differences between require and include, include_once?

3 Answers  


What is the static variable in function useful for?

0 Answers  


How can we submit a form without a submit button?

2 Answers   Rushmore Consultancy,


Categories