$dom = new DOMDocument();
$dom->loadHTML($string);
$dom->preserveWhiteSpace = false;
$elements = $dom->getElementsByTagName('span');
$spans = array();
foreach($elements as $span) {
$spans[] = $span;
}
foreach($spans as $span) {
$span->parentNode->removeChild($span);
}
return $dom->saveHTML();
//return $string;
When I use this code to parse string it changes encoding and symbols are not shown the same when return $string
is uncommented. Why is that so and how to avoid charset change
Ile