php remove anchor tag from string code example
Example: php remove anchor tag from string
$text = "<a href='http://www.google.com/'>Google1</a><br>" .
"<a>Google2</a><br>" .
"<afaketag href='http://www.google.com'>Google2</afaketag><br>" .
"<afaketag>Google4</afaketag><br>" .
"<a href='http://www.google.com'><img src='someimage.jpg'></a>";
echo preg_replace("/<\/?a( [^>]*)?>/i", "", $text);