Page 1 of 1

get parameters from <a> tag

Posted: Tue Apr 12, 2011 5:48 pm
by pedroz
How can i get all parameters from an <a> tag?

need to have the following result
$content = 'class="idz" href="http://www.domain1.com"';

Code: Select all

$content = 'asdasd <a class="idz" href="http://www.domain1.com">View this</a> hhh ';

$pattern = '/#<a(.*)>View this</a>#ims/'; 
$content = preg_replace($pattern, '$1', $content);

var_dump(content);