If all your functions are defined at the top of the file you want to include, you can add such a structure to it immediately after the function definitions:
if (something that would be true if the file was included) { return; }
For example, if the script executing include already defined a variable called $myVar , you can do:
if (isset($myVar)) return;
This will cause the included file to stop executing and return control to your original script.
However, the best solution is to create another file, for example, for example. 'functions.php' and include('functions.php'); in both scripts ...
source share