3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = simplexml_load_string('<rss version="2.0" xmlns:atom="https://www.w3.org/2005/Atom"> <channel> <item> <city>London</city> <description>Trip1</description> <link>page.php</link> <img>img.jpg</img> </item> <item> <city>London</city> <description>Trip2</description> <link>page.php</link> <img>img.jpg</img> </item> <item> <city>Paris</city> <description>Trip</description> <link>page.php</link> <img>img.jpg</img> </item> . . </channel> </rss> '); $items = $xml->xpath('//item[city[contains(.,"London")] and description[contains(.,"Trip")]]'); $items2 = $xml->xpath('//item[city[contains(.,"London")] and description[contains(.,"Trip")]][1]'); $items3 = $xml->xpath('//item[city[contains(.,"London")] and description[contains(.,"Trip")]]')[0]; var_dump($items2); var_dump($items3);
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { [0]=> object(SimpleXMLElement)#4 (4) { ["city"]=> string(6) "London" ["description"]=> string(5) "Trip1" ["link"]=> string(8) "page.php" ["img"]=> string(7) "img.jpg" } } object(SimpleXMLElement)#5 (4) { ["city"]=> string(6) "London" ["description"]=> string(5) "Trip1" ["link"]=> string(8) "page.php" ["img"]=> string(7) "img.jpg" }

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:
107.12 ms | 406 KiB | 5 Q