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/OI5un
function name:  (null)
number of ops:  29
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
   13    10        FETCH_OBJ_R                                      ~10     !0, 'documentElement'
         11        FETCH_OBJ_R                                      ~11     ~10, 'firstChild'
         12        ASSIGN                                                   !2, ~11
   15    13        INIT_METHOD_CALL                                         !1, 'registerNamespace'
         14        SEND_VAL_EX                                              'a'
         15        SEND_VAL_EX                                              'urn%3Ab'
         16        DO_FCALL                                      0          
   16    17        INIT_FCALL                                               'var_dump'
   17    18        INIT_METHOD_CALL                                         !1, 'evaluate'
   18    19        SEND_VAL_EX                                              'descendant-or-self%3A%3Aa%3A%2A'
         20        SEND_VAR_EX                                              !2
         21        DO_FCALL                                      0  $14     
   20    22        INIT_METHOD_CALL                                         $14, 'item'
         23        SEND_VAL_EX                                              0
         24        DO_FCALL                                      0  $15     
         25        FETCH_OBJ_R                                      ~16     $15, 'tagName'
         26        SEND_VAL                                                 ~16
         27        DO_ICALL                                                 
   21    28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.78 ms | 1395 KiB | 15 Q