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

Can we extend two classes in php?

719


What type of headers have to be added in the mail function to attach a file?

730


What does $_cookie mean?

710


Why php 7 is faster?

699


What is difference between static and constant in php?

695


What does the php error 'parse error in php - unexpected t_variable at line x' means?

813


What is artisan in php?

712


What is php? Why it is used?

742


What the limitation of header() function in php?

669


Which are the best start and end tags to use?

769


What is echo in html?

683


Is null function in php?

749


What is putenv?

754


Can I learn php without knowing c?

747


How to set cookies?

742