3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $html = <<<HTML <div id="test"><span>hi there</span></div> HTML; $text = '<p>hello world &trade;</p>'; $dom = new DOMDocument('1.0', 'UTF-8'); $dom->loadHTML($html); $node = $dom->getElementById('test'); var_dump($node->textContent); $node->textContent = $text; var_dump($node->textContent == $text); var_dump($dom->saveHTML($node));
Output for 5.6.8 - 7.2.6
string(8) "hi there" bool(true) string(63) "<div id="test">&lt;p&gt;hello world &amp;trade;&lt;/p&gt;</div>"
Output for 5.3.6 - 5.5.35
string(8) "hi there" bool(false) string(42) "<div id="test"><span>hi there</span></div>"
Output for 5.0.0 - 5.1.1, 5.1.3 - 5.3.5
string(8) "hi there" bool(false) Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given in /in/NlaKi on line 12 NULL
Output for 5.1.2
string(8) "hi there" bool(false) Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given in /in/NlaKi on line 13 NULL
Output for 4.3.2 - 4.4.1, 4.4.3 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/NlaKi on line 6
Process exited with code 255.
Output for 4.4.2
Fatal error: Cannot instantiate non-existent class: domdocument in /in/NlaKi on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/NlaKi on line 6