Page 1 of 1
What is the difference
Posted: Wed Apr 07, 2021 4:35 am
by rihitobach
Hi there, just a question that looks for your ideas. What is the difference between include_once() and require_once(), which one would you use in circumstances where you need to connect to a database, and why?
Re: What is the difference
Posted: Wed Apr 07, 2021 7:08 pm
by Benjamin
This sounds like a test question. Historically we don't answer questions like that. Sorry!
Re: What is the difference
Posted: Tue Apr 13, 2021 5:17 am
by richnieh
There are some really thorough explanation about these functions/statements online. For example,
https://stackoverflow.com/questions/241 ... clude-once.
Personally, I think most of the applications nowadays are using autoloaders which has require_once in most of them I think (funny that the example in PHP manual about autoloading class is using include). If you are interested, you can do some reading about autoloaders articles might be useful for you.