#28408 [Opn->Csd]: preg_match can return an array, not only an int

From: Date: Fri, 21 May 2004 14:04:38 +0000
Subject: #28408 [Opn->Csd]: preg_match can return an array, not only an int
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969360766@lists.php.net to get a copy of this message
ID: 28408 Updated by: nlopess@php.net Reported By: Progman2002 at gmx dot de -Status: Open +Status: Closed Bug Type: Documentation problem PHP Version: Irrelevant New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2004-05-15 11:32:24] Progman2002 at gmx dot de Description: ------------ Its only a typo: preg_match is defined as: int preg_match ( string pattern, string subject [, array matches [, int flags [, int offset]]]) so, it will return an integer.. which is wrong: | flags can be the following flag: | | PREG_OFFSET_CAPTURE | | If this flag is passed, for every occurring match the | appendant string offset will also be returned. Note that | this changes the return value in an array where every | element is an array consisting of the matched string at | offset 0 and its string offset into subject at offset 1. | This flag is available since PHP 4.3.0 . So it can also return an Array. | preg_match() returns FALSE if an error occurred. And it can return FALSE. So the "int" of the return-value must be changed to "mixed" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28408&edit=1

« previous php.doc (#969360766) next »