3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = <<<'XML' <?xml version="1.0" encoding="UTF-8"?> <resume> <personal_info> <birthdate>07/08/1988</birthdate> </personal_info> <jobs> <job> <company>Radio Shack</company> <title>Sales Representative</title> <startdate>01/01/2011</startdate> <enddate>02/02/2011</enddate> <duration>1.5yrs</duration> <sortdate>20110101</sortdate> </job> <job> <company>Radio Shack2</company> <title>Sales Representative</title> <startdate>01/01/2013</startdate> <enddate>02/02/2013</enddate> <duration>1.5yrs</duration> <sortdate>20130202</sortdate> </job> </jobs> </resume> XML; $xslt = <<<'XSLT' <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>My Word Download</h2> <xsl:for-each select="resume/jobs/job"> <xsl:sort select="sortdate" data-type="number" order="descending" /> <div> <xsl:value-of select="company" /> - <xsl:value-of select="title"/> </div> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet> XSLT; $xmlDom = new DOMDocument(); $xmlDom->loadXml($xml); $xslDom = new DOMDocument(); //$xslDOM->load($xsltFile); $xslDom->loadXml($xslt); $processor = new XsltProcessor(); $processor->importStylesheet($xslDom); echo $processor->transformToXml($xmlDom);
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Class 'XsltProcessor' not found in /in/5v5S7:58 Stack trace: #0 {main} thrown in /in/5v5S7 on line 58
Process exited with code 255.
Output for 5.3.0 - 5.6.28
Fatal error: Class 'XsltProcessor' not found in /in/5v5S7 on line 58
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_SL in /in/5v5S7 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_SL in /in/5v5S7 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/5v5S7 on line 3
Process exited with code 255.