3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<XML <?xml version="1.0" ?> <root xmlns:foo="uri:foo" /> XML; $doc = new DOMDocument(); $doc->loadXML($xml); // These have special-case handling at the PHP level to redirect the lookup to the libxml namespace store // https://lxr.room11.org/xref/php-src%407.2/ext/dom/element.c#285 var_dump($doc->documentElement->hasAttribute('xmlns:foo')); var_dump($doc->documentElement->getAttribute('xmlns:foo')); // This directly retrieves the libxml attribute store, which does not include the namespace declarations // https://lxr.room11.org/xref/php-src%407.2/ext/dom/node.c#569 var_dump(count($doc->documentElement->attributes)); foreach ($doc->documentElement->attributes as $attribute) { var_dump($attribute->nodeName, $attribute->nodeValue); }
Output for git.master, git.master_jit, rfc.property-hooks
bool(true) string(7) "uri:foo" int(0)

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:
176.37 ms | 405 KiB | 5 Q