3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = "<root> <parent> <child name='Child1' /> <child name='Child2' /> <subparent> <child name='Child3' /> </subparent> </parent> <child name='Child4' /> </root>"; $xml = simplexml_load_string( $xml); foreach( $xml->query( '/child' as $child)) { echo $child->attributes()['name'] . "\n"; }
Output for 5.4.0 - 5.4.20
Parse error: syntax error, unexpected 'as' (T_AS) in /in/kUpQd on line 15
Process exited with code 255.
Output for 5.3.4 - 5.3.27
Parse error: syntax error, unexpected T_AS in /in/kUpQd on line 15
Process exited with code 255.

preferences:
185.73 ms | 1395 KiB | 52 Q