3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <script type="text/javascript"> var content = '<!DOCTYPE html><html><head></head><body></body></html>' </script> <div id="test">test</div> </body> </html> HTML; $dom = new DOMDocument('1.0', 'UTF-8'); $dom->validateOnParse = true; $dom->loadHTML($html); $xpath = new \DOMXPath($dom); var_dump($xpath->query("descendant-or-self::*[@id = 'test']", $dom)); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oVcSn
function name:  (null)
number of ops:  23
compiled vars:  !0 = $html, !1 = $dom, !2 = $xpath
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3C%21DOCTYPE+html%3E%0A%3Chtml+lang%3D%22en%22%3E%0A%3Chead%3E%0A++++%3Cmeta+charset%3D%22UTF-8%22%3E%0A++++%3Ctitle%3E%3C%2Ftitle%3E%0A%3C%2Fhead%3E%0A%3Cbody%3E%0A++++%3Cscript+type%3D%22text%2Fjavascript%22%3E%0A++++var+content+%3D+%27%3C%21DOCTYPE+html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E%27%0A++++%3C%2Fscript%3E%0A++++%3Cdiv+id%3D%22test%22%3Etest%3C%2Fdiv%3E%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   19     1        NEW                                              $4      'DOMDocument'
          2        SEND_VAL_EX                                              '1.0'
          3        SEND_VAL_EX                                              'UTF-8'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $4
   20     6        ASSIGN_OBJ                                               !1, 'validateOnParse'
          7        OP_DATA                                                  <true>
   22     8        INIT_METHOD_CALL                                         !1, 'loadHTML'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0          
   24    11        NEW                                              $9      'DOMXPath'
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !2, $9
   26    15        INIT_FCALL                                               'var_dump'
         16        INIT_METHOD_CALL                                         !2, 'query'
         17        SEND_VAL_EX                                              'descendant-or-self%3A%3A%2A%5B%40id+%3D+%27test%27%5D'
         18        SEND_VAR_EX                                              !1
         19        DO_FCALL                                      0  $12     
         20        SEND_VAR                                                 $12
         21        DO_ICALL                                                 
   28    22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.13 ms | 1395 KiB | 15 Q