3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); $buffer=<<<XML <description><![CDATA[<div id="2" style="all: inherit;"><span style='font-size: 40px'>Testing123</span></div>]]></description> XML; $asString = static function (SimpleXMLElement $el) { return rtrim(explode("\n", $el->asXML(), 2)[1]); }; $makeCdata = static function (SimpleXMLElement $el, string $data) { $el[0] = null; if ($n = dom_import_simplexml($el)) { $cd = $n->ownerDocument->createCDATASection($data); $n->appendChild($cd); } }; $xml = simplexml_load_string($buffer); $cdata = simplexml_load_string((string)$xml); foreach ($cdata->xpath('@*[name(.) != "id"]|*/@*') as $attribute) unset($attribute[0]) ; $makeCdata($xml, $asString($cdata)); echo $xml->asXML();
Output for git.master, git.master_jit, rfc.property-hooks
<?xml version="1.0"?> <description><![CDATA[<div id="2"><span>Testing123</span></div>]]></description>

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
112.1 ms | 405 KiB | 5 Q