I need to extract the link value which is stored in a <a>
tag by using php code.
I used below code
$url = '<a title="Question" href="http://stackoverflow.com/questions/ask">t</a>';
preg_match("/href=\"(.*?)\"/i", $url, $matches);
print_r($matches);
With the above code I can able to get the value of a single href. But it is not working for multiple href in a string(i.e $url = '<a title="Question" href="http://stackoverflow.com/questions/ask">t</a><a href="x.php">x</a>';)
. How can I achieve this?