I have noticed a behavior in PHP that makes sense, but I am unsure how to get around it.
I have a long script, something like this
<?php
if ( file_exists("custom_version_of_this_file.php") ) {
require_once "custom_version_of_this_file.php";
exit;
}
// a bunch of code etc
function x () {
// does something
}
?>
Interestingly, the function x() will get registered with the script BEFORE the require_once() and exit are called, and therefore, firing the exit; statement does not prevent functions in the page from registering. Therefore, if I have a function x() in the require_once() file, the script will crash.
Because of the scenario I am attempting (which is, use the custom file if it exists instead of the original file, which will likely be nearly identical but slightly different), I would like to have the functions in the original (calling) file NOT get registered so that they may exist in the custom file.
Anyone know how to accomplish this?
Thanks