downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/fr/function.preg-last-error.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = 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 => 'fr',
  ),
 
'this' =>
  array (
   
0 => 'function.preg-last-error.php',
   
1 => 'preg_last_error',
  ),
 
'up' =>
  array (
   
0 => 'ref.pcre.php',
   
1 => 'Fonctions PCRE',
  ),
 
'prev' =>
  array (
   
0 => 'function.preg-grep.php',
   
1 => 'preg_grep',
  ),
 
'next' =>
  array (
   
0 => 'function.preg-match-all.php',
   
1 => 'preg_match_all',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.preg-last-error" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">preg_last_error</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0)</p><p class="refpurpose"><span class="refname">preg_last_error</span> &mdash; <span class="dc-title">Retourne le code erreur de la dernière expression PCRE exécutée</span></p>

 </div>

 <a name="function.preg-last-error.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><b>preg_last_error</b></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   Retourne le code erreur de la dernière regex PCRE exécutée.
  </p>
  <p class="para">
   </p><div class="example">
    <p><b>Exemple #1 Exemple avec <b>preg_last_error()</b></b></p>
    <div class="example-contents programlisting">
<div class="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">,&nbsp;</span><span style="color: #DD0000">'foobar&nbsp;foobar&nbsp;foobar'</span><span style="color: #007700">);<br /><br />if&nbsp;(</span><span style="color: #0000BB">preg_last_error</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">PREG_BACKTRACK_LIMIT_ERROR</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;</span><span style="color: #DD0000">'Backtrack&nbsp;limit&nbsp;was&nbsp;exhausted!'</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents para"><p>L&#039;exemple ci-dessus va afficher :</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Backtrack limit was exhausted!
</pre></div>
    </div>
   </div><p>
  </p>
 </div>


 <a name="function.preg-last-error.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Retourne une des constantes suivantes (<a href="pcre.constants.php" class="link">expliquées sur cette page</a>):
   </p><ul class="simplelist">
    <li class="member"><b><tt class="constant">PREG_NO_ERROR</tt></b></li>
    <li class="member"><b><tt class="constant">PREG_INTERNAL_ERROR</tt></b></li>
    <li class="member"><b><tt class="constant">PREG_BACKTRACK_LIMIT_ERROR</tt></b> (voir aussi <a href="pcre.configuration.php#ini.pcre.backtrack-limit" class="link">pcre.backtrack_limit</a>)</li>
    <li class="member"><b><tt class="constant">PREG_RECURSION_LIMIT_ERROR</tt></b> (voir aussi <a href="pcre.configuration.php#ini.pcre.recursion-limit" class="link">pcre.recursion_limit</a>)</li>
    <li class="member"><b><tt class="constant">PREG_BAD_UTF8_ERROR</tt></b></li>
    <li class="member"><b><tt class="constant">PREG_BAD_UTF8_OFFSET_ERROR</tt></b> (depuis PHP 5.3.0)</li>
   </ul><p>
  </p>
 </div>

</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites