3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xsl = <<<EOB <?xml version="1.0" encoding="UTF-8"?> <html xmlns:php="http://php.net/xsl" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0"> <body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE"> <xsl:for-each select="beers/beer"> <div style="background-color:teal;color:white;padding:4px"> <span style="font-weight:bold"> <xsl:value-of select="name"/> </span> <xsl:value-of select="price"/> </div> <div style="margin-left:20px;margin-bottom:1em;font-size:10pt"> <p> <xsl:value-of select="php:functionString('glob', '*.*')"/> <span style="font-style:italic"> ( <xsl:value-of select="prct"/> %) </span> </p> </div> </xsl:for-each> </body> </html> EOB; $xmldoc = DOMDocument::loadXML("http://challenge01.root-me.org/web-serveur/ch50/beers.xml"); $xsldoc = DOMDocument::loadXML($xsl); $proc = new XSLTProcessor(); $proc->registerPHPFunctions(); $proc->importStyleSheet($xsldoc); echo $proc->transformToXML($xmldoc); foreach (glob("*") as $filename) { echo "$filename occupe " . filesize($filename) . "\n"; } ?>
Output for 7.0.0 - 7.2.12
Deprecated: Non-static method DOMDocument::loadXML() should not be called statically in /in/9mj6r on line 27 Warning: DOMDocument::loadXML(): Start tag expected, '<' not found in Entity, line: 1 in /in/9mj6r on line 27 Deprecated: Non-static method DOMDocument::loadXML() should not be called statically in /in/9mj6r on line 28 Fatal error: Uncaught Error: Class 'XSLTProcessor' not found in /in/9mj6r:30 Stack trace: #0 {main} thrown in /in/9mj6r on line 30
Process exited with code 255.
Output for hhvm-3.22.0
Warning: Start tag expected, '<' not found in Entity, line: 1 in /in/9mj6r on line -1 Warning: transformToXML() expects parameter 1 to be object, null given in /in/9mj6r on line -1
Output for hhvm-3.19.2 - 3.21.3
Warning: Start tag expected, '<' not found in Entity, line: 1 in /in/9mj6r on line 27 Warning: transformToXML() expects parameter 1 to be object, null given in /in/9mj6r on line 33
Output for hhvm-3.10.1 - 3.18.5
Warning: Start tag expected, '<' not found in Entity, line: 1 Warning: transformToXML() expects parameter 1 to be object, null given in /in/9mj6r on line 33
Output for 5.0.0 - 5.1.1, 5.1.3 - 5.6.38
Strict Standards: Non-static method DOMDocument::loadXML() should not be called statically in /in/9mj6r on line 27 Warning: DOMDocument::loadXML(): Start tag expected, '<' not found in Entity, line: 1 in /in/9mj6r on line 27 Strict Standards: Non-static method DOMDocument::loadXML() should not be called statically in /in/9mj6r on line 28 Fatal error: Class 'XSLTProcessor' not found in /in/9mj6r on line 30
Process exited with code 255.
Output for 5.1.2
Strict Standards: Non-static method DOMDocument::loadXML() should not be called statically in /in/9mj6r on line 28 Warning: DOMDocument::loadXML(): Start tag expected, '<' not found in Entity, line: 1 in /in/9mj6r on line 28 Strict Standards: Non-static method DOMDocument::loadXML() should not be called statically in /in/9mj6r on line 29 Fatal error: Class 'XSLTProcessor' not found in /in/9mj6r on line 31
Process exited with code 255.
Output for 4.3.2 - 4.4.1, 4.4.3 - 4.4.9
Fatal error: Undefined class name 'domdocument' in /in/9mj6r on line 27
Process exited with code 255.
Output for 4.4.2
Fatal error: Undefined class name 'domdocument' in /in/9mj6r on line 28
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Undefined class name 'domdocument' in /in/9mj6r on line 27