3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = "<root> <parent> <child name='Child1' /> <child name='Child2' /> <subparent name='subchild'> naiya </subparent> </parent> <child name='Child4' /> </root>"; $xml = simplexml_load_string( $xml); echo $xml->xpath( '//child[@name="Child2"]'); foreach( $xml->xpath( '//child[@name="Child2"]')-> children as $child) { $attributes = $child->attributes(); echo $attributes['name'] . "\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Array to string conversion in /in/DebrH on line 15 Array Warning: Attempt to read property "children" on array in /in/DebrH on line 17 Warning: foreach() argument must be of type array|object, null given in /in/DebrH on line 17

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