title: How to stop PHP code execution?
body: <p>Is there a way to <strong>immediately</strong> stop PHP code execution?</p>
  
  <p>I am aware of <a href="http://php.net/exit">exit</a> but it clearly states:</p>
  
  <blockquote>
    <p>Terminates execution of the script. Shutdown functions and object destructors will always be executed even if exit is called.     </p>
  </blockquote>
  
  <p>So what I want to achieve is to stop the PHP code execution <strong>exactly</strong> when I call <em>exit</em> or whatever.</p>
  
  <p>Any help?</p>
  
  <p>Edit: After Jenson's answer</p>
  
  <p>Trial 1:</p>
  
  <pre><code>function newExit() {
      __halt_compiler();
  }    
  echo "start";
  newExit();    
  echo "you should not see this";
  </code></pre>
  
  <p>Shows <code>Fatal error: __HALT_COMPILER() can only be used from the outermost scope in</code> which was pretty expected.</p>
  
  <p>Trial 2:</p>
  
  <pre><code>function newExit() {
      include 'e.php';
  }
  echo "start";
  newExit();
  echo "you should not see this";
  </code></pre>
  
  <p>e.php just contains <code>__halt_compiler();</code></p>
  
  <p>This shows <strong>startyou should not see this</strong></p>
  
  <p><strong>Edit: Why I want to do this?</strong></p>
  
  <p>I am working on an application that includes a proprietary library (required through virtual host config file to which I don't have access) that comes as encrypted code. Is a sort of monitoring library for security purpose. One of it's behaviours is that it registers some shutdown functions that log the instance status (it saves stats to a database)</p>
  
  <p>What I want to do is to <strong>disable</strong> this logging for some specific conditions based on (remote IP)</p>