3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $doc = new DOMDocument(); $doc->loadXML('<root>*</root>'); $text = $doc->documentElement->childNodes->item(0); echo "Before Edit: ", $doc->saveXML($text), "\n"; $text->nodeValue = "&"; echo "After Edit 1: ", $doc->saveXML($text), "\n"; $text->nodeValue = "&amp;"; echo "After Edit 2: ", $doc->saveXML($text), "\n";
Output for 5.0.0 - 7.1.0
Before Edit: * After Edit 1: &amp; After Edit 2: &amp;amp;
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/j88Po on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/j88Po on line 2