3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<div class="something-first"> <div class="something-child something-good another something-great"> <my:text value="huhu"> </div> </div>'; libxml_use_internal_errors(true); $domDoc = new DOMDocument(); /*$domDoc->formatOutput = false; $domDoc->resolveExternals = false; $domDoc->substituteEntities = false; $domDoc->strictErrorChecking = false;*/ $domDoc->validateOnParse = false; $domDoc->loadHTML($html/*, LIBXML_NOERROR | LIBXML_NOWARNING*/); $xpath = new DOMXPath($domDoc); $xpath->registerNamespace ('my', 'http://www.example.com/' ); // -----> This results in zero nodes cause namespace gets stripped by loadHTML() $nodes = $xpath->query('//my:text'); var_dump($nodes);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bLfFQ
function name:  (null)
number of ops:  28
compiled vars:  !0 = $html, !1 = $domDoc, !2 = $xpath, !3 = $nodes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cdiv+class%3D%22something-first%22%3E%0A++++%3Cdiv+class%3D%22something-child+something-good+another+something-great%22%3E%0A++++++++%3Cmy%3Atext+value%3D%22huhu%22%3E%0A++++%3C%2Fdiv%3E%0A%3C%2Fdiv%3E'
    9     1        INIT_FCALL                                               'libxml_use_internal_errors'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                                 
   11     4        NEW                                              $6      'DOMDocument'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $6
   16     7        ASSIGN_OBJ                                               !1, 'validateOnParse'
          8        OP_DATA                                                  <false>
   18     9        INIT_METHOD_CALL                                         !1, 'loadHTML'
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0          
   19    12        NEW                                              $11     'DOMXPath'
         13        SEND_VAR_EX                                              !1
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !2, $11
   20    16        INIT_METHOD_CALL                                         !2, 'registerNamespace'
         17        SEND_VAL_EX                                              'my'
         18        SEND_VAL_EX                                              'http%3A%2F%2Fwww.example.com%2F'
         19        DO_FCALL                                      0          
   23    20        INIT_METHOD_CALL                                         !2, 'query'
         21        SEND_VAL_EX                                              '%2F%2Fmy%3Atext'
         22        DO_FCALL                                      0  $15     
         23        ASSIGN                                                   !3, $15
   24    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !3
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.62 ms | 1395 KiB | 17 Q