Search code examples
phpstringhtmlspecialchars

How to remove encoded HTML tags from a string in PHP


A web service that I am accessing send the following response...

<strong>result</strong>

How can I strip the string of these encoded tags?


Solution

  • <?php
    $str = '&lt;strong&gt;result&lt;/strong&gt;';
    echo strip_tags(html_entity_decode($str));