How to Get img src value with php?

Hello friends, today I will tell you through experts php tutorial how you can get img src values Using php program. So let�s try to understand step to step with example. index.php
<?php
$html = '<img id="12" border="0" src="/images/img.jpg"
alt="Image" width="100" height="100" />';
$doc = new DOMDocument();
$doc->loadHTML($html);
$xpath = new DOMXPath($doc);
$src = $xpath->evaluate("string(//img/@src)"); 
# "/images/img.jpg"
?>