3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<div class="classA"> <a id="someID1"></a> <div class="class1"> <div class="class2"> <div class="class3"> <div class="class4"> <h4>name, name<small>string</small></h4> </div> <div> <h4>number<small>string</small></h4> </div> </div> </div> </div> </div> <div class="classA"> <a id="someID2"></a> <div class="class1"> <div class="class2"> <div class="class3"> <div class="class4"> <h4>nameA,nameA<small>stringA</small></h4> </div> <div> <h4>numberA<small>stringB</small></h4> </div> </div> </div> </div> </div>'; $doc = new DOMDocument(); $doc->loadHTML($html); $xpath = new DOMXpath($doc); $nodes = $xpath->query("//div[@class='classA' and a[@id='someID2']]")->item(0)->getElementsByTagName("h4"); echo $nodes->item(0)->nodeValue;
Output for git.master, git.master_jit, rfc.property-hooks
nameA,nameAstringA

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