3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<'EOX' <foo> <bar attr="quux" /> </foo> EOX; $dom = new DOMDocument; $dom->loadXML($xml); $xp = new DOMXPath($dom); var_dump($xp->query('//bar/@attr')); var_dump($xp->query('//bar/@attr')->item(0));
Output for git.master, git.master_jit, rfc.property-hooks
object(DOMNodeList)#4 (1) { ["length"]=> int(1) } object(DOMAttr)#4 (21) { ["specified"]=> bool(true) ["schemaTypeInfo"]=> NULL ["name"]=> string(4) "attr" ["value"]=> string(4) "quux" ["ownerElement"]=> string(22) "(object value omitted)" ["nodeName"]=> string(4) "attr" ["nodeValue"]=> string(4) "quux" ["nodeType"]=> int(2) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> NULL ["nextSibling"]=> NULL ["attributes"]=> NULL ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(4) "attr" ["baseURI"]=> string(1) "/" ["textContent"]=> string(4) "quux" }

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:
50.58 ms | 403 KiB | 8 Q