3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $html = '<div class="something-first"> <div class="something-child something-good another something-great"> <my:text value="huhu"> </div> </div>'; libxml_use_internal_errors(true); $domDoc = new DOMDocument(); /*$domDoc->formatOutput = false; $domDoc->resolveExternals = false; $domDoc->substituteEntities = false; $domDoc->strictErrorChecking = false;*/ $domDoc->validateOnParse = false; $domDoc->loadHTML($html/*, LIBXML_NOERROR | LIBXML_NOWARNING*/); $xpath = new DOMXPath($domDoc); $xpath->registerNamespace ('my', 'http://www.example.com/' ); // -----> This results in zero nodes cause namespace gets stripped by loadHTML() $nodes = $xpath->query('//my:text'); var_dump($nodes);
Output for 5.3.11 - 5.3.29, 5.4.1 - 7.1.0
object(DOMNodeList)#3 (1) { ["length"]=> int(0) }
Output for 5.1.0 - 5.3.10, 5.4.0
object(DOMNodeList)#3 (0) { }
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function libxml_use_internal_errors() in /in/bLfFQ on line 9
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: libxml_use_internal_errors() in /in/bLfFQ on line 9
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: libxml_use_internal_errors() in /in/bLfFQ on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: libxml_use_internal_errors() in /in/bLfFQ on line 9