3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml=simplexml_load_string(<<<XML <products> <product id="001"> <name>Shirt 1 - Women's</name> <price>12.00</price> <color>blue</color> </product> <product id="002"> <name>Shirt 1 - Men's</name> <price>12.00</price> <color>red</color> </product> <product id="023"> <name>Shirt 12 - Women's</name> <price>15.00</price> <color>purple</color> </product> <product id="024"> <name>Shirt 12 - Men's</name> <price>15.00</price> <color>yellow</color> </product> </products> XML ); foreach($xml->xpath('//product[starts-with(name/text(),"")]') as $product) { echo $product->name; echo "\n"; echo $product->color; echo "\n\n"; }

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Array change keys
Shirt 1 - Women's blue Shirt 1 - Men's red Shirt 12 - Women's purple Shirt 12 - Men's yellow
Output for Lexical anon
Shirt 1 - Women's blue Shirt 1 - Men's red Shirt 12 - Women's purple Shirt 12 - Men's yellow
Output for Typed properties
Shirt 1 - Women's blue Shirt 1 - Men's red Shirt 12 - Women's purple Shirt 12 - Men's yellow

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