3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $content = '<p><img src="images/Selection_004.png" alt="" width="199" height="120" /><img src="images/Selection_005.png" alt="" width="199" height="120" /></p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vitae diam turpis. Integer fermentum metus lorem, faucibus tincidunt magna vestibulum eget. Curabitur laoreet rhoncus tellus et imperdiet. Duis dignissim, arcu eget ultrices imperdiet, urna arcu finibus enim, quis mattis nisl mauris eget erat. Etiam lectus lacus, faucibus quis erat sed, sollicitudin aliquet mi. Fusce tempus dui urna. Donec tristique, augue at molestie malesuada, nisl enim malesuada diam, at tincidunt sapien metus id enim. Fusce risus ipsum, molestie malesuada suscipit ut, imperdiet ac libero. Quisque fermentum purus quam, nec dapibus dolor tempus tempus. Vivamus dolor dui, tincidunt eu ornare eu, sollicitudin ac risus. Ut consectetur ut enim at maximus. Phasellus consequat pretium arcu. Aenean gravida finibus vestibulum. Donec mollis augue felis, a euismod quam mattis blandit. Cras auctor nisi a venenatis viverra. Morbi libero magna, feugiat in libero non, ornare tempus mi.</p> <p> </p>'; $img_pattern = '#<(img|a)(.*?)(src|href)="(.*?)"(.*?)>#s'; preg_match_all($img_pattern, $content, $matches); foreach($matches[0] as $match){ $content_image = $match[4]; } print_r($content_image);
based on MpHUv
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0rc3