3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = <<<DATA <p>a lot of some html code here</p> <p class="price"> <strong>2680 $</strong> <div>a lot of some random html code here</div> <p class="price"> <strong>3250 $</strong> <p>a lot of some good html code here</p> <p class="price"> <strong>3450 $</strong> <div id="promoted-after"></div> <p class="price"> <strong>400 $</strong> <td>a lot of some strange html code here</td> <p class="price"> <strong>401 $</strong> <div>a lot of some awesome html code here</div> <p class="price"> <strong>402 $</strong> <span>a lot of some ugly html code here</span> <p class="price"> <strong>403 $</strong> <div>a lot of some nice html code here</div> <p class="price"> <strong>404 $</strong> <table>a lot of some best html code here</table> DATA; $dom = new DOMDocument(); $dom->loadHTML($data); $xpath = new DOMXPath($dom); $items = $xpath->query('//div[@id="promoted-after"]/following-sibling::p/strong'); foreach($items as $item) { echo $item->nodeValue . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/FZtT3
function name:  (null)
number of ops:  23
compiled vars:  !0 = $data, !1 = $dom, !2 = $xpath, !3 = $items, !4 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cp%3Ea+lot+of+some+html+code+here%3C%2Fp%3E%0A%3Cp+class%3D%22price%22%3E+++%3Cstrong%3E2680+%24%3C%2Fstrong%3E%0A%3Cdiv%3Ea+lot+of+some+random+html+code+here%3C%2Fdiv%3E%0A%3Cp+class%3D%22price%22%3E+++%3Cstrong%3E3250+%24%3C%2Fstrong%3E%0A%3Cp%3Ea+lot+of+some+good+html+code+here%3C%2Fp%3E%0A%3Cp+class%3D%22price%22%3E+++%3Cstrong%3E3450+%24%3C%2Fstrong%3E%0A%3Cdiv+id%3D%22promoted-after%22%3E%3C%2Fdiv%3E%0A%3Cp+class%3D%22price%22%3E+++%3Cstrong%3E400+%24%3C%2Fstrong%3E%0A%3Ctd%3Ea+lot+of+some+strange+html+code+here%3C%2Ftd%3E%0A%3Cp+class%3D%22price%22%3E+++%3Cstrong%3E401+%24%3C%2Fstrong%3E%0A%3Cdiv%3Ea+lot+of+some+awesome+html+code+here%3C%2Fdiv%3E%0A%3Cp+class%3D%22price%22%3E+++%3Cstrong%3E402+%24%3C%2Fstrong%3E%0A%3Cspan%3Ea+lot+of+some+ugly+html+code+here%3C%2Fspan%3E%0A%3Cp+class%3D%22price%22%3E+++%3Cstrong%3E403+%24%3C%2Fstrong%3E%0A%3Cdiv%3Ea+lot+of+some+nice+html+code+here%3C%2Fdiv%3E%0A%3Cp+class%3D%22price%22%3E+++%3Cstrong%3E404+%24%3C%2Fstrong%3E%0A%3Ctable%3Ea+lot+of+some+best+html+code+here%3C%2Ftable%3E'
   23     1        NEW                                              $6      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $6
   24     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   25     7        NEW                                              $10     'DOMXPath'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $10
   26    11        INIT_METHOD_CALL                                         !2, 'query'
         12        SEND_VAL_EX                                              '%2F%2Fdiv%5B%40id%3D%22promoted-after%22%5D%2Ffollowing-sibling%3A%3Ap%2Fstrong'
         13        DO_FCALL                                      0  $13     
         14        ASSIGN                                                   !3, $13
   27    15      > FE_RESET_R                                       $15     !3, ->21
         16    > > FE_FETCH_R                                               $15, !4, ->21
   28    17    >   FETCH_OBJ_R                                      ~16     !4, 'nodeValue'
         18        CONCAT                                           ~17     ~16, '%0A'
         19        ECHO                                                     ~17
   27    20      > JMP                                                      ->16
         21    >   FE_FREE                                                  $15
   29    22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.96 ms | 998 KiB | 13 Q