3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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"); echo "test xpath: " . $entries->length; foreach($entries as $entry) { echo "\n" . $entry->nodeValue; }
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 43, Position 2 = 48
Branch analysis from position: 43
Jump found. Position 1 = 44, Position 2 = 48
Branch analysis from position: 44
Jump found. Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 48
Jump found. Position 1 = -2
Branch analysis from position: 48
filename:       /in/RGXY1
function name:  (null)
number of ops:  50
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      :-6
         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     :1
        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'
        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, ->48
        43    > > FE_FETCH_R                                               $27, !5, ->48
  16    44    >   FETCH_OBJ_R                                      $28     !5, 'nodeValue'
        45        CONCAT                                           ~29     '%0A', $28
        46        ECHO                                                     ~29
        47      > JMP                                                      ->43
        48    >   FE_FREE                                                  $27
        49      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.2.0