Answers for "php remove anchor tag from string"

PHP
0

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);
Posted by: Guest on June-24-2020

Code answers related to "php remove anchor tag from string"

Browse Popular Code Answers by Language