3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $imp = new DOMImplementation(); $dtd = $imp->createDocumentType('html'); $dom = $imp->createDocument('', '', $dtd); $html = $dom->appendChild(new DOMElement('html')); $head = $html->appendChild(new DOMElement('head')); $meta = $head->appendChild(new DOMElement('meta')); $meta->setAttribute('http-equiv', 'Content-Type'); $meta->setAttribute('content', 'text/html; charset=UTF-8'); $head->appendChild(new DOMElement('title', 'Lorem ipsum')); $body = $html->appendChild(new DOMElement('body')); $body->setAttribute('class', 'no-js'); $dom->formatOutput = FALSE; exit($dom->saveHTML());
Output for 5.3.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<!DOCTYPE html> <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Lorem ipsum</title></head><body class="no-js"></body></html>
Output for 5.0.0 - 5.3.2
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Lorem ipsum</title> </head> <body class="no-js"></body> </html>
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domimplementation in /in/9jksQ on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domimplementation in /in/9jksQ on line 3