3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<'HTML' <body>bar bar HTML; echo "Strict Error Checking: FALSE\n"; echo str_repeat("-", 50),"\n"; try { $document = new DOMDocument(); $document->strictErrorChecking = FALSE; $document->loadXML($html); } catch (Throwable $e) { echo "Catched: ", get_class($e), "\n"; } echo str_repeat("-", 50),"\n"; echo "Strict Error Checking: TRUE\n"; echo str_repeat("-", 50),"\n"; try { $document = new DOMDocument(); $document->strictErrorChecking = TRUE; $document->loadXML($html); } catch (Throwable $e) { echo "Catched: ", get_class($e), "\n"; } echo str_repeat("-", 50),"\n"; libxml_use_internal_errors(TRUE); echo "Strict Error Checking: FALSE\n"; echo str_repeat("-", 50),"\n"; try { $document = new DOMDocument(); $document->strictErrorChecking = FALSE; $document->loadHTML($html); } catch (Throwable $e) { echo "Catched: ", get_class($e), "\n"; } echo str_repeat("-", 50),"\n"; echo "Strict Error Checking: TRUE\n"; echo str_repeat("-", 50),"\n"; try { $document = new DOMDocument(); $document->strictErrorChecking = TRUE; $document->loadHTML($html); } catch (Throwable $e) { echo "Catched: ", get_class($e), "\n"; } echo str_repeat("-", 50),"\n"; $document = new DOMDocument(); $document->appendChild($document->createElement('foo')); $document->appendChild($document->createElement('foo')); echo $document->saveXML(); $document = new DOMDocument(); $document->strictErrorChecking = TRUE; $document->appendChild($document->createElement('foo')); $document->appendChild($document->createElement('foo')); echo $document->saveXML();
Output for git.master, git.master_jit, rfc.property-hooks
Strict Error Checking: FALSE -------------------------------------------------- Warning: DOMDocument::loadXML(): Premature end of data in tag body line 1 in Entity, line: 1 in /in/ssj4L on line 12 -------------------------------------------------- Strict Error Checking: TRUE -------------------------------------------------- Warning: DOMDocument::loadXML(): Premature end of data in tag body line 1 in Entity, line: 1 in /in/ssj4L on line 24 -------------------------------------------------- Strict Error Checking: FALSE -------------------------------------------------- -------------------------------------------------- Strict Error Checking: TRUE -------------------------------------------------- -------------------------------------------------- <?xml version="1.0"?> <foo/> <foo/> <?xml version="1.0"?> <foo/> <foo/>

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
48.25 ms | 403 KiB | 8 Q