3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xmlstr = "<Feed> <Title>CompanyName</Title> <Email>info@CompanyName.com</Email> <Products> <Product> <Id>4635</Id> <Number>swv8813</Number> <Title><![CDATA[&Tradition - Bellevue AJ2 - Floor Lamp White]]></Title> <Description><![CDATA[]]></Description> <Category><![CDATA[Lighting]]></Category> <Stock>0</Stock> <Price>603.00</Price> <Discount>0.00</Discount> <Created>0000-00-00 00:00:00</Created> </Product> <Product> <Id>4635</Id> <Number>swv8814</Number> <Title><![CDATA[&Tradition - Bellevue AJ2 - Floor Lamp Black]]></Title> <Description><![CDATA[]]></Description> <Category><![CDATA[Lighting]]></Category> <Stock>0</Stock> <Price>900.00</Price> <Discount>0.00</Discount> <Created>0000-00-00 00:00:00</Created> </Product> </Products> </Feed>"; $feed = new SimpleXMLElement($xmlstr); function findPrice($feed, $id){ foreach($feed->Products->Product as $product){ if($product->Number == $id){ return $product->Price; } } return null; } echo findPrice($feed, 'swv8813'); echo "\n"; echo findPrice($feed, 'swv8814');
Output for git.master, git.master_jit, rfc.property-hooks
603.00 900.00

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