3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = new DOMDocument(); //$xml->loadXML('<root><node/></root>'); $root = $xml->createElement("root"); $xml->appendChild($root); $xpath = new DOMXpath($xml); $el = $xml->createElement("testnode", "some val"); $root->appendChild($el); $xml->formatOutput = true; echo $xml->saveXML(); $entries = $xpath->query("/root/testnode[1]"); echo "test xpath: "; foreach($entries as $entry) { echo $entry->nodeValue; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 33, Position 2 = 37
Branch analysis from position: 33
2 jumps found. (Code = 78) Position 1 = 34, Position 2 = 37
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/gg85l
function name:  (null)
number of ops:  39
compiled vars:  !0 = $xml, !1 = $root, !2 = $xpath, !3 = $el, !4 = $entries, !5 = $entry
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $6      'DOMDocument'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $6
    4     3        INIT_METHOD_CALL                                         !0, 'createElement'
          4        SEND_VAL_EX                                              'root'
          5        DO_FCALL                                      0  $9      
          6        ASSIGN                                                   !1, $9
    5     7        INIT_METHOD_CALL                                         !0, 'appendChild'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
    6    10        NEW                                              $12     'DOMXpath'
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !2, $12
    7    14        INIT_METHOD_CALL                                         !0, 'createElement'
         15        SEND_VAL_EX                                              'testnode'
         16        SEND_VAL_EX                                              'some+val'
         17        DO_FCALL                                      0  $15     
         18        ASSIGN                                                   !3, $15
    8    19        INIT_METHOD_CALL                                         !1, 'appendChild'
         20        SEND_VAR_EX                                              !3
         21        DO_FCALL                                      0          
    9    22        ASSIGN_OBJ                                               !0, 'formatOutput'
         23        OP_DATA                                                  <true>
   10    24        INIT_METHOD_CALL                                         !0, 'saveXML'
         25        DO_FCALL                                      0  $19     
         26        ECHO                                                     $19
   11    27        INIT_METHOD_CALL                                         !2, 'query'
         28        SEND_VAL_EX                                              '%2Froot%2Ftestnode%5B1%5D'
         29        DO_FCALL                                      0  $20     
         30        ASSIGN                                                   !4, $20
   12    31        ECHO                                                     'test+xpath%3A+'
   13    32      > FE_RESET_R                                       $22     !4, ->37
         33    > > FE_FETCH_R                                               $22, !5, ->37
   14    34    >   FETCH_OBJ_R                                      ~23     !5, 'nodeValue'
         35        ECHO                                                     ~23
   13    36      > JMP                                                      ->33
         37    >   FE_FREE                                                  $22
   15    38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.52 ms | 1386 KiB | 13 Q