3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dom = new DOMDocument(); $dom->loadXML( '<foobar><a:foo xmlns:a="urn:a">'. '<b:bar xmlns:b="urn:b"/></a:foo>'. '</foobar>' ); $xpath = new DOMXPath($dom); // disable automatic namespace registration $xpath->enableRegisterNodeNS = FALSE; $context = $dom->documentElement->firstChild; $xpath->registerNamespace('a', 'urn:b'); var_dump( $xpath->evaluate( 'descendant-or-self::a:*', $context )->item(0)->tagName );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iFYlB
function name:  (null)
number of ops:  31
compiled vars:  !0 = $dom, !1 = $xpath, !2 = $context
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $3      'DOMDocument'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
    4     3        INIT_METHOD_CALL                                         !0, 'loadXML'
    7     4        SEND_VAL_EX                                              '%3Cfoobar%3E%3Ca%3Afoo+xmlns%3Aa%3D%22urn%3Aa%22%3E%3Cb%3Abar+xmlns%3Ab%3D%22urn%3Ab%22%2F%3E%3C%2Fa%3Afoo%3E%3C%2Ffoobar%3E'
          5        DO_FCALL                                      0          
    9     6        NEW                                              $7      'DOMXPath'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $7
   11    10        ASSIGN_OBJ                                               !1, 'enableRegisterNodeNS'
         11        OP_DATA                                                  <false>
   13    12        FETCH_OBJ_R                                      ~11     !0, 'documentElement'
         13        FETCH_OBJ_R                                      ~12     ~11, 'firstChild'
         14        ASSIGN                                                   !2, ~12
   15    15        INIT_METHOD_CALL                                         !1, 'registerNamespace'
         16        SEND_VAL_EX                                              'a'
         17        SEND_VAL_EX                                              'urn%3Ab'
         18        DO_FCALL                                      0          
   16    19        INIT_FCALL                                               'var_dump'
   17    20        INIT_METHOD_CALL                                         !1, 'evaluate'
   18    21        SEND_VAL_EX                                              'descendant-or-self%3A%3Aa%3A%2A'
         22        SEND_VAR_EX                                              !2
         23        DO_FCALL                                      0  $15     
   20    24        INIT_METHOD_CALL                                         $15, 'item'
         25        SEND_VAL_EX                                              0
         26        DO_FCALL                                      0  $16     
         27        FETCH_OBJ_R                                      ~17     $16, 'tagName'
         28        SEND_VAL                                                 ~17
         29        DO_ICALL                                                 
   21    30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.92 ms | 1396 KiB | 15 Q