← All built-ins / preg_match_all()
preg_match_all()
preg_match_all(...$args): mixed
Parameters
| Name | Type | Description |
|---|---|---|
| $pattern | string | /…/ pattern |
| $subject | string | string to search |
| $matches | array | out-parameter: one array per matchoptional |
Return value
Number of matches found; fills $matches with one sub-array per match.
Example
$m = null;
$n = preg_match_all("/\d+/", "a1 b22 c333", $m);
echo $n, " ", $m[0][0], " ", $m[0][2];3 1 333