Reputation: 237
Hello how can I replace an anchor with its inner conetent. I mean let's say I have <a someAttrs>someHtmlContent</a>
and I want someHtmlContent as output using PHP.
Upvotes: 0
Views: 173
Reputation: 6953
If you have <a someAttrs>someHtmlContent</a>
you can, use strip_tags() function in php to strips any tag in your string and convert to someHtmlContent
.
For example:
<?php
echo strip_tags("<a someAttrs>someHtmlContent</a>");
?>
will gives you desired answer. But if you must first find the anchor tags, please refer to previews answers.
Also you can find documentation of strip_tags function here.
Upvotes: 2
Reputation: 176
Would be good to use this library: http://simplehtmldom.sourceforge.net/manual.htm
or some of the others mentioned here: How do you parse and process HTML/XML in PHP?
Upvotes: 1