What's the diff. between include() and Include_once().

Answer Posted / murali

include_once() will not include a file that has already been
included. include() will include a file every time.
include_once() is useful if you have php scripts which
include scripts which include scripts. If 2 of the scripts
include the same file then you might get variables and other
things being overwritten. Using include_once() ensures you
get the functionality that the scripts need but without any
side effects.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is php dependency injection?

528


What is Mcrypt used for?

585


Tell me what are sql injections, how do you prevent them and what are the best practices?

511


What is the difference between php and core php?

494


What is T_PAAMAYIM_NEKUDOTAYIM?

678






When are you supposed to use endif to end the conditional statement?

541


How to use http headers inside php?

572


What is difference between python and php?

519


What is the use of $_server["php_self"] variable?

530


What is the difference between session_unregister() and session_unset()?

577


Can we override magic methods in php?

536


Will php die?

528


Why ide is recommended for use while programming with php?

510


What are objects in php?

532


How can I make a script that can be bilingual (supports english, german)?

593