PHP extract link from <a> tag
<?php
$string = "<a href=\"www.xyz.com/index.php\">My URL</a>\n";preg_match('|<a.+?href\="(.+?)".*?>(.+?)</a>|i', $string, $match);
$url = $match[1];
$text = $match[2];
echo "Link: ".$url;
echo "Url: ".$text;
?>
Output:
Link: www.xyz.com/index.php
Url: My URL