3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php header('Content-Type:text/html;charset=utf-8'); $xhtml = '<html> <body> <para>This is a paragraph</para> <para>This is another paragraph</para> </body> </html>'; $doc = new DOMDocument(); libxml_use_internal_errors(true); $doc->loadHTML($xhtml); $doc->preserveWhiteSpace=false; libxml_use_internal_errors(false); $xpath = new DOMXpath($doc); $elements = $xpath->query("//para"); foreach ($elements as $node){ echo $node->nodeValue. "<br/>"; }
Output for 5.1.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
This is a paragraph<br/>This is another paragraph<br/>
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function libxml_use_internal_errors() in /in/slPTM on line 13
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/slPTM on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/slPTM on line 11