Doc #53056 [Wfx]: Incomplete information for return value of preg_match
| From: | daniel at parthenonsoftware dot com | Date: | Thu, 14 Oct 2010 08:55:25 +0000 |
| Subject: | Doc #53056 [Wfx]: Incomplete information for return value of preg_match | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-5214@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
User updated by: daniel at parthenonsoftware dot com
Reported by: daniel at parthenonsoftware dot com
Summary: Incomplete information for return value of
preg_match
Status: Wont fix
Type: Documentation Problem
Package: Documentation problem
Operating System: All
PHP Version: 5.3.3
Block user comment: N
New Comment:
Then I would like to invite you to speak english
Previous Comments:
------------------------------------------------------------------------
[2010-10-14 04:49:37] aharvey@php.net
The preg_match() return values section already seems completely clear to
me.
------------------------------------------------------------------------
[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