3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = <<<END &lt;?xml version="1.0" ?&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta content="TX21_HTM 21.0.406.501" name="GENERATOR" /&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body style="font-family:'Arial';font-size:12pt;text-align:left;"&gt; &lt;p lang="en-US" style="margin-top:0pt;margin-bottom:0pt;"&gt;&lt;span style="font-family:'Verdana';font-size:9pt;"&gt;ABC1.&lt;/span&gt;&lt;/p&gt; &lt;p lang="en-US" style="margin-top:0pt;margin-bottom:0pt;"&gt;&lt;span style="font-family:'Verdana';font-size:9pt;"&gt;(ABC2)&lt;/span&gt;&lt;/p&gt; &lt;p lang="en-US" style="margin-top:0pt;margin-bottom:0pt;"&gt;&lt;span style="font-family:'Verdana';font-size:9pt;"&gt; &lt;/span&gt;&lt;/p&gt; &lt;p lang="en-US" style="margin-top:0pt;margin-bottom:0pt;"&gt;&lt;span style="font-family:'Verdana';font-size:9pt;"&gt;ABC3&lt;/span&gt;&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; END; $dom =new DOMDocument('1.0','utf-8'); $element = $dom->createElement('test', $content); $dom->appendChild($element); //header('Content-type: text/xml;'); echo $dom->saveXML();
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.4, 8.3.6 - 8.3.25, 8.4.1 - 8.4.12
<?xml version="1.0" encoding="utf-8"?> <test>&lt;?xml version="1.0" ?&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta content="TX21_HTM 21.0.406.501" name="GENERATOR" /&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body style="font-family:'Arial';font-size:12pt;text-align:left;"&gt; &lt;p lang="en-US" style="margin-top:0pt;margin-bottom:0pt;"&gt;&lt;span style="font-family:'Verdana';font-size:9pt;"&gt;ABC1.&lt;/span&gt;&lt;/p&gt; &lt;p lang="en-US" style="margin-top:0pt;margin-bottom:0pt;"&gt;&lt;span style="font-family:'Verdana';font-size:9pt;"&gt;(ABC2)&lt;/span&gt;&lt;/p&gt; &lt;p lang="en-US" style="margin-top:0pt;margin-bottom:0pt;"&gt;&lt;span style="font-family:'Verdana';font-size:9pt;"&gt; &lt;/span&gt;&lt;/p&gt; &lt;p lang="en-US" style="margin-top:0pt;margin-bottom:0pt;"&gt;&lt;span style="font-family:'Verdana';font-size:9pt;"&gt;ABC3&lt;/span&gt;&lt;/p&gt; &lt;/body&gt; &lt;/html&gt;</test>
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 <?xml version="1.0" encoding="utf-8"?> <test>&lt;?xml version="1.0" ?&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta content="TX21_HTM 21.0.406.501" name="GENERATOR" /&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body style="font-family:'Arial';font-size:12pt;text-align:left;"&gt; &lt;p lang="en-US" style="margin-top:0pt;margin-bottom:0pt;"&gt;&lt;span style="font-family:'Verdana';font-size:9pt;"&gt;ABC1.&lt;/span&gt;&lt;/p&gt; &lt;p lang="en-US" style="margin-top:0pt;margin-bottom:0pt;"&gt;&lt;span style="font-family:'Verdana';font-size:9pt;"&gt;(ABC2)&lt;/span&gt;&lt;/p&gt; &lt;p lang="en-US" style="margin-top:0pt;margin-bottom:0pt;"&gt;&lt;span style="font-family:'Verdana';font-size:9pt;"&gt; &lt;/span&gt;&lt;/p&gt; &lt;p lang="en-US" style="margin-top:0pt;margin-bottom:0pt;"&gt;&lt;span style="font-family:'Verdana';font-size:9pt;"&gt;ABC3&lt;/span&gt;&lt;/p&gt; &lt;/body&gt; &lt;/html&gt;</test>

preferences:
116.18 ms | 412 KiB | 5 Q