Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 5655

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Restores the previously defined exception handler function</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.restore-error-handler.html">restore_error_handler</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.set-error-handler.html">set_error_handler</a></div>
 <div class="up"><a href="ref.errorfunc.html">Error Handling Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.restore-exception-handler" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">restore_exception_handler</h1>
  <p class="verinfo">(PHP 5)</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="type">bool</span> <span class="methodname"><strong>restore_exception_handler</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   Used after changing the exception handler function using
    <span class="function"><a href="function.set-exception-handler.html" 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 returnvalues" id="refsect1-function.restore-exception-handler-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   This function always returns <strong><code>TRUE</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-455">
    <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 />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">exception_handler_1</span><span style="color: #007700">(</span><span style="color: #0000BB">Exception&nbsp;$e</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'['&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">__FUNCTION__&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">']&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$e</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMessage</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;</span><span style="color: #0000BB">exception_handler_2</span><span style="color: #007700">(</span><span style="color: #0000BB">Exception&nbsp;$e</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'['&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">__FUNCTION__&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">']&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$e</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMessage</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</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 />&nbsp;&nbsp;&nbsp;&nbsp;</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 />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">restore_exception_handler</span><span style="color: #007700">();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;</span><span style="color: #0000BB">Exception</span><span style="color: #007700">(</span><span style="color: #DD0000">'This&nbsp;triggers&nbsp;the&nbsp;first&nbsp;exception&nbsp;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="cdata"><pre>
[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 class="member"> <span class="function"><a href="function.set-exception-handler.html" class="function" rel="rdfs-seeAlso">set_exception_handler()</a> - Sets a user-defined exception handler function</span></li>
    <li class="member"> <span class="function"><a href="function.set-error-handler.html" class="function" rel="rdfs-seeAlso">set_error_handler()</a> - Sets a user-defined error handler function</span></li>
    <li class="member"> <span class="function"><a href="function.restore-error-handler.html" class="function" rel="rdfs-seeAlso">restore_error_handler()</a> - Restores the previous error handler function</span></li>
    <li class="member"> <span class="function"><a href="function.error-reporting.html" class="function" rel="rdfs-seeAlso">error_reporting()</a> - Sets which PHP errors are reported</span></li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.restore-error-handler.html">restore_error_handler</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.set-error-handler.html">set_error_handler</a></div>
 <div class="up"><a href="ref.errorfunc.html">Error Handling Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>