note 25362 added to function.preg-match

From: Date: Fri, 20 Sep 2002 16:22:04 +0000
Subject: note 25362 added to function.preg-match
Groups: php.notes 
Request: Send a blank email to php-notes+get-37049@lists.php.net to get a copy of this message
The return type is listed as int, but all the examples show the return type being tested as boolean. Before thinking it through I wondered if it might return the number of pattern elements matched. My quick test returned the value 1 from an successful match on six pattern elements. Although you could construct a pattern where the the match succeeds with a variable number of subexpressions matched by marking entire subexpressions as optional, it doesn't make sense to think of it this way. Are there any other possible return codes aside from 0 or 1? -- http://www.php.net/manual/en/function.preg-match.php http://master.php.net/manage/user-notes.php?action=edit+25362 http://master.php.net/manage/user-notes.php?action=delete+25362 http://master.php.net/manage/user-notes.php?action=reject+25362

« previous php.notes (#37049) next »