3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = "<root> <description> <h4>Standard Lanes</h4> <child name='Child2' /> <subparent> <child name='Child3' /> </subparent> </parent> <child name='Child4' /> </root>"; $xml = simplexml_load_string( $xml); foreach( $xml->xpath( './/h4') as $child) { echo $child->attributes()['name'] . "\n"; }
based on 180CZ
Output for 7.0.0 - 7.1.0
Warning: simplexml_load_string(): Entity: line 8: parser error : Opening and ending tag mismatch: description line 2 and parent in /in/vvPSo on line 13 Warning: simplexml_load_string(): </parent> in /in/vvPSo on line 13 Warning: simplexml_load_string(): ^ in /in/vvPSo on line 13 Fatal error: Uncaught Error: Call to a member function xpath() on boolean in /in/vvPSo:15 Stack trace: #0 {main} thrown in /in/vvPSo on line 15
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Warning: simplexml_load_string(): Entity: line 8: parser error : Opening and ending tag mismatch: description line 2 and parent in /in/vvPSo on line 13 Warning: simplexml_load_string(): </parent> in /in/vvPSo on line 13 Warning: simplexml_load_string(): ^ in /in/vvPSo on line 13 Fatal error: Call to a member function xpath() on boolean in /in/vvPSo on line 15
Process exited with code 255.
Output for 5.4.0 - 5.5.35
Warning: simplexml_load_string(): Entity: line 8: parser error : Opening and ending tag mismatch: description line 2 and parent in /in/vvPSo on line 13 Warning: simplexml_load_string(): </parent> in /in/vvPSo on line 13 Warning: simplexml_load_string(): ^ in /in/vvPSo on line 13 Fatal error: Call to a member function xpath() on a non-object in /in/vvPSo on line 15
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ',' or ';' in /in/vvPSo on line 16
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[', expecting ',' or ';' in /in/vvPSo on line 16
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `','' or `';'' in /in/vvPSo on line 16
Process exited with code 255.