3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $sxe = new SimpleXMLElement('<people xmlns:p="http://example.org/ns" xmlns:t="http://example.org/test"/>'); $xpath = new DOMXPath(($doc = dom_import_simplexml($sxe)->ownerDocument)); print_r(iterator_to_array($xpath->evaluate('/*/namespace::*')));
Output for 5.3.11 - 5.3.29, 5.4.1 - 7.1.0
Array ( [0] => DOMNameSpaceNode Object ( [nodeName] => xmlns:xml [nodeValue] => http://www.w3.org/XML/1998/namespace [nodeType] => 18 [prefix] => xml [localName] => xml [namespaceURI] => http://www.w3.org/XML/1998/namespace [ownerDocument] => (object value omitted) [parentNode] => (object value omitted) ) [1] => DOMNameSpaceNode Object ( [nodeName] => xmlns:t [nodeValue] => http://example.org/test [nodeType] => 18 [prefix] => t [localName] => t [namespaceURI] => http://example.org/test [ownerDocument] => (object value omitted) [parentNode] => (object value omitted) ) [2] => DOMNameSpaceNode Object ( [nodeName] => xmlns:p [nodeValue] => http://example.org/ns [nodeType] => 18 [prefix] => p [localName] => p [namespaceURI] => http://example.org/ns [ownerDocument] => (object value omitted) [parentNode] => (object value omitted) ) )
Output for 5.3.7 - 5.3.10, 5.4.0
Array ( [0] => DOMNameSpaceNode Object ( ) [1] => DOMNameSpaceNode Object ( ) [2] => DOMNameSpaceNode Object ( ) )
Output for 5.3.6
Array ( [23980432] => DOMNameSpaceNode Object ( ) )
Output for 5.3.5
Array ( [19425680] => DOMNameSpaceNode Object ( ) )
Output for 5.3.4
Array ( [24361360] => DOMNameSpaceNode Object ( ) )
Output for 5.3.3
Array ( [37534096] => DOMNameSpaceNode Object ( ) )
Output for 5.2.0 - 5.3.2
Catchable fatal error: Argument 1 passed to iterator_to_array() must implement interface Traversable, instance of DOMNodeList given in /in/b8M6B on line 4
Process exited with code 255.
Output for 5.1.0 - 5.1.6
Warning: iterator_to_array() expects parameter 1 to be Traversable, object given in /in/b8M6B on line 4
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function iterator_to_array() in /in/b8M6B on line 4
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/b8M6B on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/b8M6B on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/b8M6B on line 3
Process exited with code 255.