3v4l.org

run code in 300+ PHP versions simultaneously
<?php $doc = new DOMDocument('1.0', 'UTF-8'); $doc->loadXML('<root xmlns:ns="foo" ns:id="1"> <one/> <two/> <three/> <four/> <five/> </root>'); $finder = new DOMXPath($doc); $nodes = $finder->query("//node()[namespace::ns]"); foreach ($nodes as $n) { var_dump($doc->saveXML($n)); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 25
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 25
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/4qZhu
function name:  (null)
number of ops:  27
compiled vars:  !0 = $doc, !1 = $finder, !2 = $nodes, !3 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $4      'DOMDocument'
          1        SEND_VAL_EX                                              '1.0'
          2        SEND_VAL_EX                                              'UTF-8'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $4
    4     5        INIT_METHOD_CALL                                         !0, 'loadXML'
          6        SEND_VAL_EX                                              '%3Croot+xmlns%3Ans%3D%22foo%22+ns%3Aid%3D%221%22%3E+%3Cone%2F%3E+%3Ctwo%2F%3E+%3Cthree%2F%3E+%3Cfour%2F%3E+%3Cfive%2F%3E+%3C%2Froot%3E'
          7        DO_FCALL                                      0          
    5     8        NEW                                              $8      'DOMXPath'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !1, $8
    6    12        INIT_METHOD_CALL                                         !1, 'query'
         13        SEND_VAL_EX                                              '%2F%2Fnode%28%29%5Bnamespace%3A%3Ans%5D'
         14        DO_FCALL                                      0  $11     
         15        ASSIGN                                                   !2, $11
    7    16      > FE_RESET_R                                       $13     !2, ->25
         17    > > FE_FETCH_R                                               $13, !3, ->25
    8    18    >   INIT_FCALL                                               'var_dump'
         19        INIT_METHOD_CALL                                         !0, 'saveXML'
         20        SEND_VAR_EX                                              !3
         21        DO_FCALL                                      0  $14     
         22        SEND_VAR                                                 $14
         23        DO_ICALL                                                 
    7    24      > JMP                                                      ->17
         25    >   FE_FREE                                                  $13
    9    26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.27 ms | 1396 KiB | 15 Q