<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.errorfunc.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.restore-exception-handler.php',
    1 => 'restore_exception_handler',
    2 => 'Restores the previously defined exception handler function',
  ),
  'up' => 
  array (
    0 => 'ref.errorfunc.php',
    1 => 'Error Handling Functions',
  ),
  'prev' => 
  array (
    0 => 'function.restore-error-handler.php',
    1 => 'restore_error_handler',
  ),
  'next' => 
  array (
    0 => 'function.set-error-handler.php',
    1 => 'set_error_handler',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/errorfunc/functions/restore-exception-handler.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.restore-exception-handler" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">restore_exception_handler</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">restore_exception_handler</span> &mdash; <span class="dc-title">
   Restores the previously defined exception handler function
  </span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.restore-exception-handler-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>restore_exception_handler</strong></span>(): <span class="type"><a href="language.types.singleton.php" class="type true">true</a></span></div>

  <p class="para rdfs-comment">
   Used after changing the exception handler function using
   <span class="function"><a href="function.set-exception-handler.php" class="function">set_exception_handler()</a></span>, to revert to the previous
   exception handler (which could be the built-in or a user defined
   function).
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.restore-exception-handler-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">This function has no parameters.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.restore-exception-handler-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Always returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.restore-exception-handler-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 <span class="function"><strong>restore_exception_handler()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />    </span><span style="color: #007700">function </span><span style="color: #0000BB">exception_handler_1</span><span style="color: #007700">(</span><span style="color: #0000BB">Exception $e</span><span style="color: #007700">)<br />    {<br />        echo </span><span style="color: #DD0000">'[' </span><span style="color: #007700">. </span><span style="color: #0000BB">__FUNCTION__ </span><span style="color: #007700">. </span><span style="color: #DD0000">'] ' </span><span style="color: #007700">. </span><span style="color: #0000BB">$e</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMessage</span><span style="color: #007700">();<br />    }<br /><br />    function </span><span style="color: #0000BB">exception_handler_2</span><span style="color: #007700">(</span><span style="color: #0000BB">Exception $e</span><span style="color: #007700">)<br />    {<br />        echo </span><span style="color: #DD0000">'[' </span><span style="color: #007700">. </span><span style="color: #0000BB">__FUNCTION__ </span><span style="color: #007700">. </span><span style="color: #DD0000">'] ' </span><span style="color: #007700">. </span><span style="color: #0000BB">$e</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMessage</span><span style="color: #007700">();<br />    }<br /><br />    </span><span style="color: #0000BB">set_exception_handler</span><span style="color: #007700">(</span><span style="color: #DD0000">'exception_handler_1'</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">set_exception_handler</span><span style="color: #007700">(</span><span style="color: #DD0000">'exception_handler_2'</span><span style="color: #007700">);<br /><br />    </span><span style="color: #0000BB">restore_exception_handler</span><span style="color: #007700">();<br /><br />    throw new </span><span style="color: #0000BB">Exception</span><span style="color: #007700">(</span><span style="color: #DD0000">'This triggers the first exception handler...'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">[exception_handler_1] This triggers the first exception handler...</pre>
</div>
    </div>
   </div>
  </p>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-function.restore-exception-handler-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.set-exception-handler.php" class="function" rel="rdfs-seeAlso">set_exception_handler()</a> - Sets a user-defined exception handler function</span></li>
    <li><span class="function"><a href="function.get-exception-handler.php" class="function" rel="rdfs-seeAlso">get_exception_handler()</a> - Gets the user-defined exception handler function</span></li>
    <li><span class="function"><a href="function.set-error-handler.php" class="function" rel="rdfs-seeAlso">set_error_handler()</a> - Sets a user-defined error handler function</span></li>
    <li><span class="function"><a href="function.restore-error-handler.php" class="function" rel="rdfs-seeAlso">restore_error_handler()</a> - Restores the previous error handler function</span></li>
    <li><span class="function"><a href="function.error-reporting.php" class="function" rel="rdfs-seeAlso">error_reporting()</a> - Sets which PHP errors are reported</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>