3v4l.org

run code in 500+ PHP versions simultaneously
<?php $body = '<p><a href="#">link</a><a href="#">another</a><button>button</button><i>some text</i></p>'; $dom = new DOMDocument; @$dom->loadHTML("<?xml version='1.0' encoding='UTF-8'?><body>$body</body>"); $xpath = new DOMXPath($dom); $nodelist = $xpath->query('//a | //button'); // echo "Length is : " . $nodelist->length, PHP_EOL; foreach ($nodelist as $index => $node) { echo "Node $index is $node->nodeName" . PHP_EOL; }
Output for git.master_jit, rfc.property-hooks, git.master
Length is : 3 Node 0 is a Node 1 is a Node 2 is button

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:
92.24 ms | 1252 KiB | 4 Q