<?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.error-get-last.php',
    1 => 'error_get_last',
    2 => 'Get the last occurred error',
  ),
  'up' => 
  array (
    0 => 'ref.errorfunc.php',
    1 => 'Error Handling Functions',
  ),
  'prev' => 
  array (
    0 => 'function.error-clear-last.php',
    1 => 'error_clear_last',
  ),
  'next' => 
  array (
    0 => 'function.error-log.php',
    1 => 'error_log',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/errorfunc/functions/error-get-last.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.error-get-last" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">error_get_last</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">error_get_last</span> &mdash; <span class="dc-title">Get the last occurred error</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.error-get-last-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>error_get_last</strong></span>(): <span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.array.php" class="type array">array</a></span></span></div>

  <p class="para rdfs-comment">
   Gets information about the last error that occurred.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.error-get-last-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">This function has no parameters.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.error-get-last-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns an associative array describing the last error with keys &quot;type&quot;,
   &quot;message&quot;, &quot;file&quot; and &quot;line&quot;. If the error has been caused by a PHP
   internal function then the &quot;message&quot; begins with its name.
   Returns <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> if there hasn&#039;t been an error yet.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.error-get-last-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 An <span class="function"><strong>error_get_last()</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">echo </span><span style="color: #0000BB">$a</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">error_get_last</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
something similar to:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Array
(
    [type] =&gt; 8
    [message] =&gt; Undefined variable: a
    [file] =&gt; C:\WWW\index.php
    [line] =&gt; 2
)</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.error-get-last-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><a href="errorfunc.constants.php" class="link">Error constants</a></li>
    <li>Variable <var class="varname"><a href="reserved.variables.phperrormsg.php" class="classname">$php_errormsg</a></var></li>
    <li><span class="function"><a href="function.error-clear-last.php" class="function" rel="rdfs-seeAlso">error_clear_last()</a> - Clear the most recent error</span></li>
    <li><a href="errorfunc.configuration.php#ini.display-errors" class="link">Directive <code class="parameter">display_errors</code></a></li>
    <li><a href="errorfunc.configuration.php#ini.html-errors" class="link">Directive <code class="parameter">html_errors</code></a></li>
    <li><a href="errorfunc.configuration.php#ini.xmlrpc-errors" class="link">Directive <code class="parameter">xmlrpc_errors</code></a></li>
   </ul>
  </p>
 </div>


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