3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<XML <?xml version="1.0" ?> <root> <child> <grandchild/> </child> <child> <grandchild/> </child> </root> XML; $doc = new DOMDocument; $doc->loadXML($xml); $xpath = new DOMXPath($doc); foreach ($xpath->query('./*', $doc->documentElement) as $el) { echo $el->tagName . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 23
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 23
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/DhtEU
function name:  (null)
number of ops:  25
compiled vars:  !0 = $xml, !1 = $doc, !2 = $xpath, !3 = $el
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+%3F%3E%0A%3Croot%3E%0A++%3Cchild%3E%0A++++%3Cgrandchild%2F%3E%0A++%3C%2Fchild%3E%0A++%3Cchild%3E%0A++++%3Cgrandchild%2F%3E%0A++%3C%2Fchild%3E%0A%3C%2Froot%3E'
   15     1        NEW                                              $5      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
   16     4        INIT_METHOD_CALL                                         !1, 'loadXML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   17     7        NEW                                              $9      'DOMXPath'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $9
   19    11        INIT_METHOD_CALL                                         !2, 'query'
         12        SEND_VAL_EX                                              '.%2F%2A'
         13        CHECK_FUNC_ARG                                           
         14        FETCH_OBJ_FUNC_ARG                               $12     !1, 'documentElement'
         15        SEND_FUNC_ARG                                            $12
         16        DO_FCALL                                      0  $13     
         17      > FE_RESET_R                                       $14     $13, ->23
         18    > > FE_FETCH_R                                               $14, !3, ->23
   20    19    >   FETCH_OBJ_R                                      ~15     !3, 'tagName'
         20        CONCAT                                           ~16     ~15, '%0A'
         21        ECHO                                                     ~16
   19    22      > JMP                                                      ->18
         23    >   FE_FREE                                                  $14
   21    24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.31 ms | 1394 KiB | 13 Q