PHP find image

29.Jun.2010

If you want to use PHP to find image in your HTML, you can use following PHP script:

1
2
3
$htmlCode = 'Some HTML with image <img src="/demo.jpg">';
preg_match("#<img(.*)src=(.*)>#i", $htmlCode, $match);
echo $match[0];