<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.pcre.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.preg-last-error-msg.php',
    1 => 'preg_last_error_msg',
    2 => 'Returns the error message of the last PCRE regex execution',
  ),
  'up' => 
  array (
    0 => 'ref.pcre.php',
    1 => 'PCRE Functions',
  ),
  'prev' => 
  array (
    0 => 'function.preg-last-error.php',
    1 => 'preg_last_error',
  ),
  'next' => 
  array (
    0 => 'function.preg-match.php',
    1 => 'preg_match',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/pcre/functions/preg-last-error-msg.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.preg-last-error-msg" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">preg_last_error_msg</h1>
  <p class="verinfo">(PHP 8)</p><p class="refpurpose"><span class="refname">preg_last_error_msg</span> &mdash; <span class="dc-title">Returns the error message of the last PCRE regex execution</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.preg-last-error-msg-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>preg_last_error_msg</strong></span>(): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Returns the error message of the last PCRE regex execution.
  </p>
 </div>


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


 <div class="refsect1 returnvalues" id="refsect1-function.preg-last-error-msg-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns the error message on success, or <code class="literal">&quot;No error&quot;</code> if no
   error has occurred.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.preg-last-error-msg-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 <span class="function"><strong>preg_last_error_msg()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />preg_match</span><span style="color: #007700">(</span><span style="color: #DD0000">'/(?:\D+|&lt;\d+&gt;)*[!?]/'</span><span style="color: #007700">, </span><span style="color: #DD0000">'foobar foobar foobar'</span><span style="color: #007700">);<br /><br />if (</span><span style="color: #0000BB">preg_last_error</span><span style="color: #007700">() !== </span><span style="color: #0000BB">PREG_NO_ERROR</span><span style="color: #007700">) {<br />    echo </span><span style="color: #0000BB">preg_last_error_msg</span><span style="color: #007700">();<br />}<br /><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="annotation-interactive examplescode"><pre class="examplescode">Backtrack limit exhausted</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.preg-last-error-msg-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.preg-last-error.php" class="function" rel="rdfs-seeAlso">preg_last_error()</a> - Returns the error code of the last PCRE regex execution</span></li>
   </ul>
  </p>
 </div>


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