3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = simplexml_load_string('<root/>'); $node = $xml->NOT_EXISTING_NODE_NAME; var_dump($node instanceof \SimpleXMLElement); var_dump($node->asXML()); var_dump($node->count()); var_dump($node->getName()); echo "\nattributes:\n"; $node2 = $node->attributes(); var_dump($node2 instanceof \SimpleXMLElement); var_dump($node2->asXML()); var_dump($node2->count()); var_dump($node2->getName()); echo "\nchildren:\n"; $node3 = $node->children(); var_dump($node3 instanceof \SimpleXMLElement); var_dump($node3->asXML()); var_dump($node3->count()); var_dump($node3->getName());
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.3.0alpha1
bool(true) bool(false) int(0) string(0) "" attributes: bool(true) Warning: SimpleXMLElement::asXML(): Node no longer exists in /in/1BHKS on line 13 Warning: SimpleXMLElement::asXML(): Node no longer exists in /in/1BHKS on line 13 bool(false) Warning: SimpleXMLElement::count(): Node no longer exists in /in/1BHKS on line 14 int(0) Warning: SimpleXMLElement::getName(): Node no longer exists in /in/1BHKS on line 15 Warning: SimpleXMLElement::getName(): Node no longer exists in /in/1BHKS on line 15 string(0) "" children: bool(true) Warning: SimpleXMLElement::asXML(): Node no longer exists in /in/1BHKS on line 20 Warning: SimpleXMLElement::asXML(): Node no longer exists in /in/1BHKS on line 20 bool(false) Warning: SimpleXMLElement::count(): Node no longer exists in /in/1BHKS on line 21 int(0) Warning: SimpleXMLElement::getName(): Node no longer exists in /in/1BHKS on line 22 Warning: SimpleXMLElement::getName(): Node no longer exists in /in/1BHKS on line 22 string(0) ""
Output for hhvm-3.18.4 - 3.21.0
bool(true) bool(false) int(0) string(0) "" attributes: bool(true) bool(false) int(0) string(0) "" children: bool(true) bool(false) int(0) string(0) ""