Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #remove #anchor #tag #string
ADD COMMENT
Topic
Name
4+6 =