3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = <<<XML <?xml version="1.0" encoding="UTF-8" ?> <root> <ARTICLEDATA> <ARTICLE> <A_PRICEDATA> <A_PRICE channel="1" currency="EUR"> <A_VK>34.95</A_VK> </A_PRICE> </A_PRICEDATA> <A_MEDIADATA> <A_MEDIA type="image" origname="9990.jpg">https://1.jpg</A_MEDIA> <A_MEDIA type="image" origname="11260.jpg">https://2.jpg</A_MEDIA> <A_MEDIA type="image" origname="12294.jpg">https://3.jpg</A_MEDIA> <A_MEDIA type="image" origname="13306.jpg">https://4.jpg</A_MEDIA> <A_MEDIA type="image" origname="13012.jpg">https://5.jpg</A_MEDIA> <A_MEDIA type="image" origname="13760.jpg">https://6.jpg</A_MEDIA> </A_MEDIADATA> </ARTICLE> <ARTICLE> <A_PRICEDATA> <A_PRICE channel="1" currency="EUR"> <A_VK>19.95</A_VK> </A_PRICE> </A_PRICEDATA> <A_MEDIADATA> <A_MEDIA type="image" origname="9990.jpg">https://10.jpg</A_MEDIA> <A_MEDIA type="image" origname="11260.jpg">https://2.jpg</A_MEDIA> <A_MEDIA type="image" origname="12294.jpg">https://3.jpg</A_MEDIA> <A_MEDIA type="image" origname="13306.jpg">https://4.jpg</A_MEDIA> <A_MEDIA type="image" origname="13012.jpg">https://5.jpg</A_MEDIA> <A_MEDIA type="image" origname="13760.jpg">https://6.jpg</A_MEDIA> </A_MEDIADATA> </ARTICLE> </ARTICLEDATA> </root> XML; $xml = simplexml_load_string($str); $articles = ""; foreach ($xml->ARTICLEDATA->ARTICLE as $article) { $price = (string)$article->A_PRICEDATA->A_PRICE->A_VK; $firstImage = (string)$article->A_MEDIADATA->A_MEDIA[0]; $produkt = "Product 1"; $articles .= '<div class="photo"><img src="' . $firstImage . '" style="width: 120px margin:5px;"><div class="product-info mt__15"><h3 class="product-title pr fs__14 mg__0 fwm">' . $produkt . '</h3><span class="price">€' . $price . ' EUR</span></div></div>'; } echo $articles;
Output for rfc.property-hooks, git.master, git.master_jit
<div class="photo"><img src="https://1.jpg" style="width: 120px margin:5px;"><div class="product-info mt__15"><h3 class="product-title pr fs__14 mg__0 fwm">Product 1</h3><span class="price">€34.95 EUR</span></div></div><div class="photo"><img src="https://10.jpg" style="width: 120px margin:5px;"><div class="product-info mt__15"><h3 class="product-title pr fs__14 mg__0 fwm">Product 1</h3><span class="price">€19.95 EUR</span></div></div>

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:
54.19 ms | 1492 KiB | 4 Q