3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = '<?xml version="1.0" encoding="UTF-8"?><html> <head> <title>Waa?</title> </head> <body> <ul> <li><img src="http://i.mg" alt="waa?" /><li /></li> </ul> </body> </html>'; /* $doc = new DOMDocument('1.0', 'UTF-8'); $doc->resolveExternals = true; $doc->loadXML($xml); $doc->validate(); */ $root = 'html'; $systemId = "http://office.react.nl/~arjen/php/xhtml1-transitional.dtd"; $creator = new DOMImplementation; $doctype = $creator->createDocumentType($root, null, $systemId); $new = $creator->createDocument(null, null, $doctype); $new->encoding = "utf-8"; $new->resolveExternals = true; var_dump($new->doctype === $doctype); $new->loadXML($xml); var_dump($new->doctype === $doctype); $new->validate();
Output for 5.3.0 - 7.1.0
bool(true) bool(false) Warning: DOMDocument::validate(): no DTD found! in /in/hrYHn on line 31
Output for 5.1.0 - 5.2.17
bool(true) bool(false) Notice: DOMDocument::validate(): No DTD given in XML-Document in /in/hrYHn on line 31 Warning: DOMDocument::validate(): no DTD found! in /in/hrYHn on line 31
Output for 5.0.0 - 5.0.5
bool(true) bool(false) Notice: DOMDocument::validate(): No DTD given in XML-Document in /in/hrYHn on line 31 Warning: no DTD found! in /in/hrYHn on line 31
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domimplementation in /in/hrYHn on line 23
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domimplementation in /in/hrYHn on line 23