title: Php exit function question
body: <p>I have noticed a behavior in PHP that makes sense, but I am unsure how to get around it.</p>
  
  <p>I have a long script, something like this</p>
  
  <pre><code>&lt;?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
   }
  ?&gt;
  </code></pre>
  
  
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>Anyone know how to accomplish this?</p>
  
  <p>Thanks</p>