|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-08-16 10:03 UTC] vrana@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 21 00:00:02 2025 UTC |
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.