September 10, 2013
Extract string from a tag using php
User1432345’s Question:
How to extract the link domain name using php.
Eg,
Search engine <a href="http://www.google.com">Google Search</a> and <a href="www.yahoo.co.in">Yahoo Search</a>
I need from this –
Search engine google and yahoo
You can remove all the HTML tags using strip_tags()
(as stated in comments)
$text = 'Search engine <a href="http://www.google.com">Google</a> and <a href="www.yahoo.co.in">Yahoo</a>';
echo strip_tags($text); //This will give only the text