How to remove encoded HTML tags from a string in PHP
Asked Answered
S

1

7

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

<strong>result</strong>

How can I strip the string of these encoded tags?

Swastika answered 11/11, 2011 at 3:22 Comment(3)
maybe convert to HTML and then strip_tags?Chromatics
#658143Overweary
I tried using htmlspecialchars and html_entity_decode in conjunction. I missed the strip_tagsSwastika
C
15
<?php
$str = '&lt;strong&gt;result&lt;/strong&gt;';
echo strip_tags(html_entity_decode($str));
Chromatics answered 11/11, 2011 at 3:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.