3v4l.org

run code in 300+ PHP versions simultaneously
<?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();

preferences:
51.21 ms | 402 KiB | 5 Q