preg_match_all()always returns an array (if successful, otherwise you get an empty array), where index 0contains an array with an element for each integer match, and the remaining indices become capture groups with an internal array for each match.
It might be easier to understand ...
array(2) {
[0]=>
array(2) {
[0]=>
string(12) "entire match"
[1]=>
string(32) "entire match matched second time"
}
[1]=>
array(2) {
[0]=>
string(15) "capturing group"
[1]=>
string(35) "capturing group matched second time"
}
}
source
share