title: Any way to exit outer function from within inner function?
body: <p>Within PHP, if I have one function that calls another function; is there any way to get the called function to exit out of the caller function without killing the entire script?</p>
  
  <p>For instance, let's say I have some code something like:</p>
  
  <pre><code>&lt;?php
  function funcA() {
      funcB();
      echo 'Hello, we finished funcB';
  }
  
  function funcB() {
      echo 'This is funcB';
  }
  ?&gt;
  &lt;p&gt;This is some text. After this text, I'm going to call funcA.&lt;/p&gt;
  &lt;p&gt;&lt;?php funcA(); ?&gt;&lt;/p&gt;
  &lt;p&gt;This is more text after funcA ran.&lt;/p&gt;
  </code></pre>
  
  <p>Unfortunately, if I find something inside of funcB that makes me want to stop funcA from finishing, I seem to have to exit the entire PHP script. Is there any way around this?</p>
  
  <p>I understand that I could write something into funcA() to check for a result from funcB(), but, in my case, I have no control over the contents of funcA(); I only have control over the contents of funcB().</p>
  
  <p>To make this example a little more concrete; in this particular instance, I am working with WordPress. I am hooking into <a href="http://core.trac.wordpress.org/browser/tags/3.1.1/wp-includes/general-template.php#L96" rel="noreferrer">the get_template_part() function</a>, and trying to stop WordPress from actually requiring/including the file through the locate_template() function that's called after my hook is executed.</p>
  
  <p>Does anyone have any advice?</p>