I have been struggling with this problem since yesterday - unfortunately, to no avail (not completely, I found some workaround), and after some research and re-reading the documentation, I'm still a little stunned and confused.
Suppose there is an ugly line that already has special characters correctly encoded in html. eg:
$exampleString = '<div id="dynamic2"> <div
id="iStoreProductLongDescription" class="iStoreBox">
<div class="iStoreBoxWrapper"> <div
class="iStoreBoxContent"> <p style="text-
align:justify;"> </p> <p style="text-
align:justify;"><span style="font-
size:large;"><span> Just a bunch of text here, at
the end. yedyedyed';
Now I would like to output this string as a simple clean string, so first I will need to convert it to html tags, and then split the tags. Therefore, I assume that the following chain should work:
$result = strip_tags(htmlspecialchars_decode($exampleString));
but it is not, echo $ result output to the web page source:
<div id="dynamic2"> <div id="iStoreProductLongDescription" class="iStoreBox"> <div class="iStoreBoxWrapper"> <div class="iStoreBoxContent"> <p style="text-align:justify;"> </p> <p style="text-align:justify;"><span style="font-size:large;"><span> Just a bunch o text here, at the end. yedyedyed
In custom outputs, html tags are visible and remain intact. However, when I do something like this:
$result = strip_tags(html_entity_decode(htmlspecialchars_decode($exampleString)));
, -:
, . yedyedyed
-
strip_tags(htmlspecialchars_decode($exampleString));
( ), ?
.