3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = "<root> <parent> <child name='Child1'><a href=\"aaaa\">AAA</a></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); foreach( $xml->xpath( './/child[position() = 1]') as $child) { echo $child->xml "\n"; }
Output for 5.4.0 - 5.4.25
Parse error: syntax error, unexpected '"\n"' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in /in/EVVjV on line 16
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /in/EVVjV on line 16
Process exited with code 255.

preferences:
183.53 ms | 1395 KiB | 62 Q