3v4l.org

run code in 500+ PHP versions simultaneously
<?php $xml = <<<END <?xml version="1.0" encoding="UTF-8"?> <root> <child attribute="value" /> <child hello="world" /> </root> END; $doc = new DOMDocument(); $doc->loadXML($xml); assert($doc->firstChild->childNodes[3]->attributes['hello'] === $doc->firstChild->childNodes->item(3)->attributes->getNamedItem('hello')); assert($doc->firstChild->childNodes[3]->attributes['hello']->nodeValue === 'world');

preferences:
22.29 ms | 474 KiB | 4 Q