I have 2 php files:
index.php (5KB)
blob.php (50,000KB - yes, 50mb php file)
Now, index.php contains an if statement. Like this:
if (temp>3){
blah blah
} else {
require 'blob.php';
}
Will php load all of the 50MB every time index.php is requested or only when that part of the if statement is valid?
edit – cleaned the question to be more meaningful. Take the 50mb as just an example of “very large file”. I knew you guys would lose focus of the question so I tried to simplify the problem in advance and it backfired.
As the require is a normal PHP function it will only be executed in the else case, which means the file shouldn’t be included in the other case. Think of
echoin the file which would then be printet even if the else path isn’t executed.But again, WHY do you have 50MB of scripts?
If you are including several script may an autoloader would be a better way then including them “manually” (see here)…