ID: 42159
Updated by: [EMAIL PROTECTED]
Reported By: johannes dot ponader at web 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.
"matches: Array of all matches in multi-dimensional array ordered
according to flags."
Previous Comments:
------------------------------------------------------------------------
[2007-07-31 13:47:51] johannes dot ponader at web dot de
Description:
------------
Hi,
the documentation of preg_match_all seems to be corrupt.
In the *Parameters* section the description for *matches* says:
"matches
In this case, $matches[0] is the first set of matches, and
$matches[0][0] has text matched by full pattern, $matches[0][1] has text
matched by first subpattern and so on. Similarly, $matches[1] is the
second set of matches, etc. "
This applies only when the flag PREG_SET_ORDER is set (non-default).
The beginning "In this case" without giving information about which
case is meant indicates that there is something missing. The correct
documentation could be like written here in the field "Expected
result".
Thanks,
Johannes Ponader
Expected result:
----------------
matches
By default, $matches[0] is an array of full pattern matches,
$matches[1] is an array of strings matched by the first parenthesized
subpattern, and so on. $matches[0][0] is the first match of the full
pattern, $matches[0][1] is the second match etc.. $matches[1][0] is the
first match of the first subpattern.
If the Flag PREG_SET_ORDER is set, the array is ordered differently. In
this case...
(continues like in actual version)
Actual result:
--------------
matches
In this case, $matches[0] is the first set of matches, and
$matches[0][0] has text matched by full pattern, $matches[0][1] has text
matched by first subpattern and so on. Similarly, $matches[1] is the
second set of matches, etc.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42159&edit=1