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); $el = $xml->createElement("testnode", "some val 2"); $root->appendChild($el); $xml->formatOutput = true; echo $xml->saveXML(); $entries = $xpath->query("/root/testnode[1]"); echo "test xpath: " . $entries->length; foreach($entries as $entry) { echo $entry->nodeValue; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 43, Position 2 = 47
Branch analysis from position: 43
2 jumps found. (Code = 78) Position 1 = 44, Position 2 = 47
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
filename:       /in/UZtd8
function name:  (null)
number of ops:  49
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        INIT_METHOD_CALL                                         !0, 'createElement'
         23        SEND_VAL_EX                                              'testnode'
         24        SEND_VAL_EX                                              'some+val+2'
         25        DO_FCALL                                      0  $18     
         26        ASSIGN                                                   !3, $18
   10    27        INIT_METHOD_CALL                                         !1, 'appendChild'
         28        SEND_VAR_EX                                              !3
         29        DO_FCALL                                      0          
   11    30        ASSIGN_OBJ                                               !0, 'formatOutput'
         31        OP_DATA                                                  <true>
   12    32        INIT_METHOD_CALL                                         !0, 'saveXML'
         33        DO_FCALL                                      0  $22     
         34        ECHO                                                     $22
   13    35        INIT_METHOD_CALL                                         !2, 'query'
         36        SEND_VAL_EX                                              '%2Froot%2Ftestnode%5B1%5D'
         37        DO_FCALL                                      0  $23     
         38        ASSIGN                                                   !4, $23
   14    39        FETCH_OBJ_R                                      ~25     !4, 'length'
         40        CONCAT                                           ~26     'test+xpath%3A+', ~25
         41        ECHO                                                     ~26
   15    42      > FE_RESET_R                                       $27     !4, ->47
         43    > > FE_FETCH_R                                               $27, !5, ->47
   16    44    >   FETCH_OBJ_R                                      ~28     !5, 'nodeValue'
         45        ECHO                                                     ~28
   15    46      > JMP                                                      ->43
         47    >   FE_FREE                                                  $27
   17    48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.05 ms | 1390 KiB | 13 Q