3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = "<root> <parent> <child name='Child1'>AAAA</child> <child name='Child2'>BBBB</child> <subparent> <child name='Child3'>CCCC</child> </subparent> </parent> <child name='Child4'>DDDD</child> </root>"; $xml = simplexml_load_string( $xml); echo $xml->xpath( './/child[position() = 2]; /*foreach( $xml->xpath( './/child[position() = 2]') as $child) { echo $child->attributes()['name'] . "\n"; }*/
Output for 5.4.0 - 5.4.25
Parse error: syntax error, unexpected 'echo' (T_ECHO) in /in/nC0Au on line 17
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_ECHO in /in/nC0Au on line 17
Process exited with code 255.

preferences:
191.04 ms | 1386 KiB | 62 Q