Questions About Includes
Posted: Sat Jul 17, 2004 2:20 am
I am a complete novice at this wonderful PHP stuff, so please bare with me. Working with PHP has inspired me to begin delving into other wonderful things like database design, C++, Java, etc.. My initial research into some of these other languages has led me to begin organizing and structuring my work differently.
Ideally, I would like to keep each class and subclass definition in its own seperate file and link to them as needed, or perhaps at times include a file which simply includes a collection of includes, thus creating a library of sorts. I am wondering how far you can actually push that before disk reads become noticable and/or a problem (assuming we are on a relatively decent server)?
Also, I am curious about the philosophical and technical differences between using include() versus require(). What would be a common reason to include a file that you were not sure if it existed or not? Why would you not first do an is_file() check, or some such, before attempting to include a file which you know full well may not be there? Would there be any disadvantages to requiring files that you have every reason to expect to be there?
Ideally, I would like to keep each class and subclass definition in its own seperate file and link to them as needed, or perhaps at times include a file which simply includes a collection of includes, thus creating a library of sorts. I am wondering how far you can actually push that before disk reads become noticable and/or a problem (assuming we are on a relatively decent server)?
Also, I am curious about the philosophical and technical differences between using include() versus require(). What would be a common reason to include a file that you were not sure if it existed or not? Why would you not first do an is_file() check, or some such, before attempting to include a file which you know full well may not be there? Would there be any disadvantages to requiring files that you have every reason to expect to be there?