3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $oXMLWriter = new XMLWriter; $oXMLWriter->openMemory(); $oXMLWriter->startDocument('1.0', 'UTF-8'); $oXMLWriter->startElement('test'); $oXMLWriter->writeAttribute('value', "Just <span style=\"color:red\">testing</span>:漢字"); $oXMLWriter->text('Hello, World!'); $oXMLWriter->endElement(); $oXMLWriter->endDocument(); echo htmlspecialchars($oXMLWriter->outputMemory(TRUE));
Output for 5.1.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;test value=&quot;Just &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;testing&amp;lt;/span&amp;gt;:漢字&quot;&gt;Hello, World!&lt;/test&gt;
Output for 5.0.0 - 5.1.1
Fatal error: Class 'XMLWriter' not found in /in/Fmdud on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: xmlwriter in /in/Fmdud on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: xmlwriter in /in/Fmdud on line 3