From 834eb7f2098468cb9d23f801d82bbd91f75e0cc4 Mon Sep 17 00:00:00 2001 From: Sander Roobol Date: Sun, 12 May 2002 16:13:12 +0000 Subject: [PATCH] Fix return values of preg_match() and preg_match_all() git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@81982 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/pcre/functions/preg-match-all.xml | 6 +++--- reference/pcre/functions/preg-match.xml | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/reference/pcre/functions/preg-match-all.xml b/reference/pcre/functions/preg-match-all.xml index c5a6439016..1a1f560042 100644 --- a/reference/pcre/functions/preg-match-all.xml +++ b/reference/pcre/functions/preg-match-all.xml @@ -1,5 +1,5 @@ - + @@ -101,8 +101,8 @@ print $out[1][0].", ".$out[1][1]."\n"; to be PREG_PATTERN_ORDER. - Returns the number of full pattern matches, or &false; if - no match is found or an error occurred. + Returns the number of full pattern matches (which might be zero), + or &false; if an error occurred. diff --git a/reference/pcre/functions/preg-match.xml b/reference/pcre/functions/preg-match.xml index f563aa6f52..67af36e9bc 100644 --- a/reference/pcre/functions/preg-match.xml +++ b/reference/pcre/functions/preg-match.xml @@ -1,5 +1,5 @@ - + @@ -25,9 +25,13 @@ the first captured parenthesized subpattern, and so on. - Returns &true; if a match for pattern was - found in the subject string, or &false; if not match was found - or an error occurred. + preg_match returns the number of times + pattern matches. That will be either 0 times + (no match) or 1 time because preg_match will stop + searching after the first match. preg_match_all + on the contrary will continue until it reaches the end of + subject. + preg_match returns &false; if an error occured.