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); // create an xpath object and register the namespaces $xpath = new DOMXpath($dom); foreach ($ns as $prefix => $uri) { $xpath->registerNamespace($prefix, $uri); } //$dom->getElementsByTagNameNS($ns["gmd"], "fileIdentifier")->item(0)->nodeValue = "something"; foreach ($xpath->query("//gmd:fileIdentifier/gco:CharacterString") as $element) { $element->nodeValue = "something"; } echo $dom->saveXML(); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 27
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 27
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 27
2 jumps found. (Code = 77) Position 1 = 32, Position 2 = 36
Branch analysis from position: 32
2 jumps found. (Code = 78) Position 1 = 33, Position 2 = 36
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
Branch analysis from position: 27
filename:       /in/ucM6F
function name:  (null)
number of ops:  41
compiled vars:  !0 = $xml, !1 = $dom, !2 = $sxe, !3 = $ns, !4 = $xpath, !5 = $uri, !6 = $prefix, !7 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%0A%3Cgvq%3AGVQ_Metadata+id%3D%22dataset_MD%22+xmlns%3Aupdated19115%3D%22http%3A%2F%2Fwww.geoviqua.org%2F19115_updates%22+xmlns%3Agmx%3D%22http%3A%2F%2Fwww.isotc211.org%2F2005%2Fgmx%22+xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22+xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22+xmlns%3Agmd%3D%22http%3A%2F%2Fwww.isotc211.org%2F2005%2Fgmd%22+xmlns%3Agco%3D%22http%3A%2F%2Fwww.isotc211.org%2F2005%2Fgco%22+xmlns%3Agvq%3D%22http%3A%2F%2Fwww.geoviqua.org%2FQualityInformationModel%2F4.0%22+xmlns%3Agml%3D%22http%3A%2F%2Fwww.opengis.net%2Fgml%2F3.2%22+xmlns%3Agmd19157%3D%22http%3A%2F%2Fwww.geoviqua.org%2Fgmd19157%22+xmlns%3Aun%3D%22http%3A%2F%2Fwww.uncertml.org%2F2.0%22+xmlns%3Aqml%3D%22http%3A%2F%2Fqualityml.geoviqua.org%2F1.0%22+xsi%3AschemaLocation%3D%22http%3A%2F%2Fwww.geoviqua.org%2FQualityInformationModel%2F4.0+http%3A%2F%2Fschemas.geoviqua.org%2FGVQ%2F4.0%2FGeoViQua_PQM_UQM.xsd+http%3A%2F%2Fwww.uncertml.org%2F2.0+http%3A%2F%2Fqualityml.geoviqua.org%2Fschemas%2Funcertml%2F2.0%2Funcertml.xsd+http%3A%2F%2Fqualityml.geoviqua.org%2F1.0+http%3A%2F%2Fqualityml.geoviqua.org%2Fschemas%2Fqualityml%2F1.0%2Fqualityml.xsd%22%3E%0A++++%3Cgmd%3AfileIdentifier%3E%0A++++++++%3Cgco%3ACharacterString%3Emtri2an1ib%3C%2Fgco%3ACharacterString%3E%0A++++%3C%2Fgmd%3AfileIdentifier%3E%0A%3C%2Fgvq%3AGVQ_Metadata%3E'
   11     1        NEW                                              $9      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $9
   12     4        INIT_METHOD_CALL                                         !1, 'loadXML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   15     7        NEW                                              $13     'SimpleXMLElement'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $13
   16    11        INIT_METHOD_CALL                                         !2, 'getDocNamespaces'
         12        SEND_VAL_EX                                              <true>
         13        DO_FCALL                                      0  $16     
         14        ASSIGN                                                   !3, $16
   19    15        NEW                                              $18     'DOMXpath'
         16        SEND_VAR_EX                                              !1
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !4, $18
   20    19      > FE_RESET_R                                       $21     !3, ->27
         20    > > FE_FETCH_R                                       ~22     $21, !5, ->27
         21    >   ASSIGN                                                   !6, ~22
   21    22        INIT_METHOD_CALL                                         !4, 'registerNamespace'
         23        SEND_VAR_EX                                              !6
         24        SEND_VAR_EX                                              !5
         25        DO_FCALL                                      0          
   20    26      > JMP                                                      ->20
         27    >   FE_FREE                                                  $21
   26    28        INIT_METHOD_CALL                                         !4, 'query'
         29        SEND_VAL_EX                                              '%2F%2Fgmd%3AfileIdentifier%2Fgco%3ACharacterString'
         30        DO_FCALL                                      0  $25     
         31      > FE_RESET_R                                       $26     $25, ->36
         32    > > FE_FETCH_R                                               $26, !7, ->36
   27    33    >   ASSIGN_OBJ                                               !7, 'nodeValue'
         34        OP_DATA                                                  'something'
   26    35      > JMP                                                      ->32
         36    >   FE_FREE                                                  $26
   30    37        INIT_METHOD_CALL                                         !1, 'saveXML'
         38        DO_FCALL                                      0  $28     
         39        ECHO                                                     $28
   32    40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.44 ms | 1399 KiB | 13 Q