DOMDocument and HTML entities
character-encoding, domdocument, php
Solution
This is no direct answer to the question, but you may use UTF-8 instead, which allows you to save glyphs like ÷ or × directly. To use UTF-8 with PHP DOM on the other needs a little hack.
Also, if you are trying to display mathematical formulas (as A × B suggests) have a look at MathML.
Problem
I'm trying to parse some HTML that includes some HTML entities, like × ``` $str = '<a href="http://example.com/"> A × B</a>'; $dom = new DomDocument; $dom -> substituteEntities = false; $dom ->loadHTML($str); $link = $dom ->getElementsByTagName('a') -> item(0); $fullname = $link -> nodeValue; $href = $link -> getAttribute('href'); echo " fullname: $fullname \n href: $href\n"; ``` but DomDocument substitutes the text for for A × B. Is there some way to keep it from taking the & for an HTML entity and make it just leave it alone? I tried to set substituteEntities to false but it doesn't do anything