3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = '<lib id="ITEM_I_WANT_TO_DOWNLOAD_1" revision="0000"> <part id="0000" type="ch"/> <part id="0000" type="ls"/> <part id="0000" type="rs"/> <part id="0000" type="ch"/> </lib> <lib id="ITEM_I_WANT_TO_DOWNLOAD_2" revision="0000"> <part id="0000" type="ch"/> <part id="0000" type="ls"/> <part id="0000" type="rs"/> <part id="0000" type="ch"/> </lib>'; $xml = '<mydocument>' . $xml . '</mydocument>'; // repair invalid xml https://stackoverflow.com/q/4544272/2943403 $doc = new DOMDocument(); $doc->loadXml($xml); $xpath = new DOMXpath($doc); foreach ($xpath->evaluate('//lib/@id') as $attr) { $result[] = $attr->value; } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 'ITEM_I_WANT_TO_DOWNLOAD_1', 1 => 'ITEM_I_WANT_TO_DOWNLOAD_2', )

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:
42.52 ms | 401 KiB | 8 Q