3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<html><body><div id="fred" class="item active" style="display: block; left: 685.5753504672897px; top: 0px; height: 475.3125px; width: 318.84929906542055px; font-size: 100%; z-index: 32768; visibility: visible;"> <canvas class="content landscape" href="#" src="imgs/dead.jpg" title="The Dead Weather - Horehound" id="3" num="0" song="Horehound" origproportion="1.0062305295950156" width="323" height="482"></canvas></div></body></html>'; $doc = new DOMDocument(); $doc->loadXML($html); $xpath = new DOMXPath($doc); $resulted = $xpath->query('//div[contains(@class,"active")]'); echo 'Found items: ' , $resulted->length , "\n"; var_dump($resulted); foreach ($resulted as $result) { $active = $result->query('div[@class="content"]'); var_dump($active); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 32
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 32
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/Ls93u
function name:  (null)
number of ops:  34
compiled vars:  !0 = $html, !1 = $doc, !2 = $xpath, !3 = $resulted, !4 = $result, !5 = $active
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Chtml%3E%3Cbody%3E%3Cdiv+id%3D%22fred%22+class%3D%22item+active%22+style%3D%22display%3A+block%3B+left%3A+685.5753504672897px%3B+top%3A+0px%3B+height%3A+475.3125px%3B+width%3A+318.84929906542055px%3B+font-size%3A+100%25%3B+z-index%3A+32768%3B+visibility%3A+visible%3B%22%3E%0A%3Ccanvas+class%3D%22content+landscape%22+href%3D%22%23%22+src%3D%22imgs%2Fdead.jpg%22+title%3D%22The+Dead+Weather+-+Horehound%22+id%3D%223%22+num%3D%220%22+song%3D%22Horehound%22+origproportion%3D%221.0062305295950156%22+width%3D%22323%22+height%3D%22482%22%3E%3C%2Fcanvas%3E%3C%2Fdiv%3E%3C%2Fbody%3E%3C%2Fhtml%3E'
    6     1        NEW                                              $7      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $7
    7     4        INIT_METHOD_CALL                                         !1, 'loadXML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
    8     7        NEW                                              $11     'DOMXPath'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $11
    9    11        INIT_METHOD_CALL                                         !2, 'query'
         12        SEND_VAL_EX                                              '%2F%2Fdiv%5Bcontains%28%40class%2C%22active%22%29%5D'
         13        DO_FCALL                                      0  $14     
         14        ASSIGN                                                   !3, $14
   11    15        ECHO                                                     'Found+items%3A+'
         16        FETCH_OBJ_R                                      ~16     !3, 'length'
         17        ECHO                                                     ~16
         18        ECHO                                                     '%0A'
   13    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                                 
   15    22      > FE_RESET_R                                       $18     !3, ->32
         23    > > FE_FETCH_R                                               $18, !4, ->32
   16    24    >   INIT_METHOD_CALL                                         !4, 'query'
         25        SEND_VAL_EX                                              'div%5B%40class%3D%22content%22%5D'
         26        DO_FCALL                                      0  $19     
         27        ASSIGN                                                   !5, $19
   17    28        INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !5
         30        DO_ICALL                                                 
   15    31      > JMP                                                      ->23
         32    >   FE_FREE                                                  $18
   18    33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.29 ms | 1392 KiB | 15 Q