3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = 'This is my test string with an <img test /> image. <test />'; $pattern = '/<([a-zA-Z0-9]*)(.*)\/>/iU'; $count = preg_match_all($pattern, $string, $matches, PREG_SET_ORDER); print_r($matches);
based on mCHX7
Output for 5.3.18 - 7.2.0
Array ( [0] => Array ( [0] => <img test /> [1] => [2] => img test ) [1] => Array ( [0] => <test /> [1] => [2] => test ) )