3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = <<<EOT <?xml version="1.0" ?> <Y><X>6098881</X></Y> EOT; $sxml = new SimpleXMLElement($xml); foreach ($sxml->children() as $xmlKey => $xmlNode) { var_dump( empty($xmlNode), (string) $xmlNode, $xmlNode->asxml() ); } $xmlNode = new SimpleXMLElement('<X>501936634a721</X>'); var_dump( empty($xmlNode), (string) $xmlNode, $xmlNode->asxml() );
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
bool(false) string(7) "6098881" string(14) "<X>6098881</X>" bool(false) string(13) "501936634a721" string(43) "<?xml version="1.0"?> <X>501936634a721</X> "
Output for 4.3.2 - 4.4.1, 4.4.3 - 4.4.9
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/7puS7 on line 7
Process exited with code 255.
Output for 4.4.2
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/7puS7 on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/7puS7 on line 7