Php Remove Anchor Tag From String

[Solved] Php Remove Anchor Tag From String | Php - Code Explorer | yomemimo.com
Question : php remove anchor tag from string

Answered by : geeky-bravo

$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);

Source : https://stackoverflow.com/questions/5870201/remove-anchors-from-text | Last Update : Wed, 01 Jul 20

Answers related to php remove anchor tag from string

Code Explorer Popular Question For Php