array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'function.preg-last-error.php', 1 => 'preg_last_error', ), 'up' => array ( 0 => 'ref.pcre.php', 1 => 'PCRE-Funktionen', ), 'prev' => array ( 0 => 'function.preg-last-error-msg.php', 1 => 'preg_last_error_msg', ), 'next' => array ( 0 => 'function.preg-match-all.php', 1 => 'preg_match_all', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'de', 'path' => 'reference/pcre/functions/preg-last-error.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
preg_last_error — Liefert den Fehlercode der letzten PCRE-RegEx-Auswertung
Gibt den Fehlercode der letzten PCRE-RegEx-Auswertung zurück.
Beispiel #1 preg_last_error()-Beispiel
<?php
preg_match('/(?:\D+|<\d+>)*[!?]/', 'foobar foobar foobar');
if (preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR) {
echo 'Das Backtrack-Limit wurde erreicht!';
}
?>
Das oben gezeigte Beispiel erzeugt folgende Ausgabe:
Das Backtrack-Limit wurde erreicht!
Diese Funktion besitzt keine Parameter.
Diese Funktion gibt eine der folgenden Konstanten zurück: