3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<EOD <?xml version="1.0" encoding="UTF-8"?> <gvq:GVQ_Metadata id="dataset_MD" xmlns:updated19115="http://www.geoviqua.org/19115_updates" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gvq="http://www.geoviqua.org/QualityInformationModel/4.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:gmd19157="http://www.geoviqua.org/gmd19157" xmlns:un="http://www.uncertml.org/2.0" xmlns:qml="http://qualityml.geoviqua.org/1.0" xsi:schemaLocation="http://www.geoviqua.org/QualityInformationModel/4.0 http://schemas.geoviqua.org/GVQ/4.0/GeoViQua_PQM_UQM.xsd http://www.uncertml.org/2.0 http://qualityml.geoviqua.org/schemas/uncertml/2.0/uncertml.xsd http://qualityml.geoviqua.org/1.0 http://qualityml.geoviqua.org/schemas/qualityml/1.0/qualityml.xsd"> <gmd:fileIdentifier> <gco:CharacterString>mtri2an1ib</gco:CharacterString> </gmd:fileIdentifier> </gvq:GVQ_Metadata> EOD; $dom = new DOMDocument; $dom->loadXML($xml); // get all the namespaces in the document $sxe = new SimpleXMLElement($xml); $ns = $sxe->getDocNamespaces(TRUE); print_r($dom->getElementsByTagNameNS($ns["gmd"], "fileIdentifier")->item(0)); ?>
Output for 8.3.0 - 8.3.7
DOMElement Object ( [schemaTypeInfo] => [tagName] => gmd:fileIdentifier [className] => [id] => [firstElementChild] => (object value omitted) [lastElementChild] => (object value omitted) [childElementCount] => 1 [previousElementSibling] => [nextElementSibling] => [nodeName] => gmd:fileIdentifier [nodeValue] => mtri2an1ib [nodeType] => 1 [parentNode] => (object value omitted) [parentElement] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted) [nextSibling] => (object value omitted) [attributes] => (object value omitted) [isConnected] => 1 [ownerDocument] => (object value omitted) [namespaceURI] => http://www.isotc211.org/2005/gmd [prefix] => gmd [localName] => fileIdentifier [baseURI] => / [textContent] => mtri2an1ib )
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
DOMElement Object ( [schemaTypeInfo] => [tagName] => gmd:fileIdentifier [firstElementChild] => (object value omitted) [lastElementChild] => (object value omitted) [childElementCount] => 1 [previousElementSibling] => [nextElementSibling] => [nodeName] => gmd:fileIdentifier [nodeValue] => mtri2an1ib [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted) [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => http://www.isotc211.org/2005/gmd [prefix] => gmd [localName] => fileIdentifier [baseURI] => / [textContent] => mtri2an1ib )
Output for 8.0.0 - 8.0.30
DOMElement Object ( [tagName] => gmd:fileIdentifier [schemaTypeInfo] => [firstElementChild] => (object value omitted) [lastElementChild] => (object value omitted) [childElementCount] => 1 [previousElementSibling] => [nextElementSibling] => [nodeName] => gmd:fileIdentifier [nodeValue] => mtri2an1ib [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted) [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => http://www.isotc211.org/2005/gmd [prefix] => gmd [localName] => fileIdentifier [baseURI] => / [textContent] => mtri2an1ib )
Output for 5.3.11 - 5.3.29, 5.4.1 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.2.29 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33
DOMElement Object ( [tagName] => gmd:fileIdentifier [schemaTypeInfo] => [nodeName] => gmd:fileIdentifier [nodeValue] => mtri2an1ib [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted) [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => http://www.isotc211.org/2005/gmd [prefix] => gmd [localName] => fileIdentifier [baseURI] => / [textContent] => mtri2an1ib )
Output for 5.1.2 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.10, 5.4.0
DOMElement Object ( )
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.1
Fatal error: Call to undefined method SimpleXMLElement::getDocNamespaces() in /in/62JW1 on line 15
Process exited with code 255.
Output for 4.4.3 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/62JW1 on line 17
Process exited with code 255.
Output for 4.4.2
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/62JW1 on line 18
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/62JW1 on line 17
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/62JW1 on line 17
Process exited with code 255.

preferences:
212.79 ms | 401 KiB | 348 Q