- print_r: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$string = 'This is my test string with an <img test /> image.';
$pattern = '/<([a-zA-Z0-9]*)(.*)\/>/i';
$count = preg_match_all($pattern, $string, $matches, PREG_PATTERN_ORDER);
print_r($matches);