Suppose there is a condition

if (условие) { require_once 'raz.php'; } else { require_once 'dva.php'; } 

Will both files be connected? Or just the one that fits the condition? Does PHP request a file that is not needed by condition? Does he see him as

 if (условие) { echo 'Первый'; } else { echo 'Второй'; } 

or how

 if (условие) { echo 'Первый'; } else { require_once 'dva.php'; } 

When content raz.php:

 echo 'Первый'; 

dva.php:

 echo 'Второй'; 
  • 3
    Why don’t you insert it once and don’t look at what is called and it will take 2 minutes. - Vasily Barbashev
  • How to check? I see only the result: 'First'. Whether the second file is loaded I do not see. It is likely that you can check if you compare the processing speed of the file. The question has been written, as it is possible that someone has already conducted similar experiments or somewhere in php.net the behavior is spelled out. - Natalia Mitrofanova
  • If the file is loaded, it will be processed and output the result. If it did not display anything, then it did not boot. - Vasily Barbashev

2 answers 2

As for measuring the difference in download speeds - this, of course, is an idea so- so.

But you can still check, and much easier

 if (false) require 'non_existent_file'; } echo "Не грузит"; 
  • Really much simpler :) - Natalya Mitrofanova

The condition will be met. Files will not be loaded if the condition is not met.