December 26th, 1999, 02:46 PM
if **include("file.inc")** is inside a function() or class->function(), will "file.inc" be parsed with the rest of the code in the very begining or only if function() was executed?
Alex D. G.
December 26th, 1999, 03:06 PM
Only if the function is executed. include() is best used in functions or conditionals.
require() is parsed no matter what when the main script is parsed. This is best for loops as the file will only be accessed and parsed once. If you use include() inside a loop, the file will have to be accessed and parsed with each loop. Not very efficient.