Doc #53056 [Opn->Wfx]: Incomplete information for return value of preg_match

From: Date: Thu, 14 Oct 2010 02:49:37 +0000
Subject: Doc #53056 [Opn->Wfx]: Incomplete information for return value of preg_match
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5212@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53056&edit=1 ID: 53056 Updated by: aharvey@php.net Reported by: daniel at parthenonsoftware dot com Summary: Incomplete information for return value of preg_match -Status: Open +Status: Wont fix Type: Documentation Problem Package: Documentation problem Operating System: All PHP Version: 5.3.3 Block user comment: N New Comment: The preg_match() return values section already seems completely clear to me. Previous Comments: ------------------------------------------------------------------------ [2010-10-14 00:05:45] daniel at parthenonsoftware dot com Description: ------------ While the documentation accurately tells the programmer that preg_match returns an int, the documentation does not reflect the meaning of the return value. As an example, in shell scripting, 0 represents true, where another number typically represents an error code. Returning 0 from a main application means everything went successfully. Further, in some languages like C/C++, 0 is the default return value, basically meaning "Everything fine nothing to see here move along please". ;-) The confusion comes from the fact that the preg_match() function returns 1 if a match is found and 0 otherwise. By adding this sentence to the documentation for preg_match: The preg_match() function returns 1 if a match is found and 0 otherwise. A fair bit of confusion would be cleared up by defining the non-standard meaning up front. Actual result: -------------- tt ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53056&edit=1

« previous php.doc.bugs (#5212) next »