3v4l.org

run code in 300+ PHP versions simultaneously
<?php $doc = new DOMDocument(); $root = $doc->appendChild($doc->createElement('root')); $root->setAttribute('xmlns:foo', 'uri:foo'); var_dump($root->hasAttribute('xmlns:foo'), $root->getAttribute('xmlns:foo')); foreach ($root->attributes as $k => $attribute) { var_dump($attribute->nodeName, $attribute->nodeValue); }

preferences:
30.07 ms | 404 KiB | 5 Q