3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml ='<?xml version="1.0" encoding="utf-8"?> <products> <product ID="12345"> <name>Sunny Beach Resort</name> <price currency="EUR">439.00</price> <URL>https://www.example.com/</URL> <images> <image>https://www.example.com/images/image.jpg</image> </images> <properties> <property name="country"> <value>Spanje</value> </property> <property name="region"> <value>Gran Canaria</value> </property> <property name="cityURL"> <value>https://www.example.com/</value> </property> <property name="serviceType"> <value>Logies ontbijt</value> </property> </properties> <variations> <variation> <property name="roomType"> <value>2-persoonskamer luxe type voor alleengebruik</value> </property> <property name="roomOccupation"> <value>geschikt voor 1 persoon</value> </property> </variation> <variation> <property name="roomType"> <value>2-persoonskamer luxe type standaard</value> </property> <property name="roomOccupation"> <value>geschikt voor 2 tot 3 personen</value> </property> </variation> </variations> </product></products>'; $xml = new simplexmlelement($xml); foreach($xml->product as $product) { foreach($product->properties->property as $property) { if($property['name'] == 'serviceType'){ echo 'Service type is' . $property->value . ' for ' . $product ->name; } } }
Output for git.master, git.master_jit, rfc.property-hooks
Service type isLogies ontbijt for Sunny Beach Resort

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