Hello. I have a string called $string and it has a lot of content (including HTML). It also contains a lot of links with different attributes (e.g. onclick, href, style, id). How do I add the rel="nofollow" attribute to all these links without breaking them? And assign the new content to $string again. Regards!
why don't you just make this really simple with something like this? $string = str_replace('href','rel="nofollow" href',$string);