get parameters from <a> tag

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pedroz
Forum Commoner
Posts: 99
Joined: Thu Nov 03, 2005 6:21 am

get parameters from <a> tag

Post 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);
Post Reply