Source Code:
(back to article)
<?php $pattern = '/[0-9]+/'; $string = 'This is a test string with 1234 and 5678'; if (preg_match_all($pattern, $string, $matches)) { echo 'Number of matches found: ' . count($matches[0]); } else { echo 'No match found.'; }
Result:
Report an issue