I have 3 different files-
fileMainIncludeEverywhere.php
... include_once('fileMinorInclude.php'); ?>
fileMinorInclude.php
... include_once('fileMainIncludeEverywhere.php'); ...
fileToRun.php
... include_once('fileMainIncludeEverywhere.php'); ...
I have a lot of files like fileToRun.php.
Currently I'm not facing any errors in my code, but I want to know if there's any case where this would fail?
I think no error in this case. Because
include_once
will only load the file for the first time then upcoming load request will be rejected for the same file.So from your example:
fileToRun.php
will loadfileMainIncludeEverywhere.php
(first call)fileMainIncludeEverywhere.php
will loadfileMinorInclude.php
(first call)fileMinorInclude.php
will call to loadfileMainIncludeEverywhere.php
but it will be rejected as it has been already loaded in first step.Hope it will help.