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_oncewill only load the file for the first time then upcoming load request will be rejected for the same file.So from your example:
fileToRun.phpwill loadfileMainIncludeEverywhere.php(first call)fileMainIncludeEverywhere.phpwill loadfileMinorInclude.php(first call)fileMinorInclude.phpwill call to loadfileMainIncludeEverywhere.phpbut it will be rejected as it has been already loaded in first step.Hope it will help.