3v4l.org

run code in 300+ PHP versions simultaneously
<?php // from your file $xml = ' <main> <div class="DetailsPanel"> <label class="ListLabel left">Location</label> <span id="location" class="ListDetail left" title="London, UK">London, UK</span> <label class="ListLabel left">Price</label> <span id="price" class="ListDetail left" title="£5000">£5000</span> <label class="ListLabel left">Sector</label> <span class="ListDetail left"> <a href="/">IT</a> <a href="/">ICT</a> </span> </div> <div class="DetailsPanel"> <label class="ListLabel left">Location</label> <span id="location" class="ListDetail left" title="London, UK">London, UK</span> <label class="ListLabel left">Price</label> <span id="price" class="ListDetail left" title="£5000">£5000</span> <label class="ListLabel left">Sector</label> <span class="ListDetail left"> <a href="/">IT</a> <a href="/">ICT</a> </span> </div> </main> '; $xmldoc = new DOMDocument(); //$xmldoc->load('yourFile.html'); $xmldoc->loadXML($xml); $xpath = new Domxpath($xmldoc); $query = "//div[@class='DetailsPanel']"; foreach($xpath->query($query) as $node){ $string = $node->nodeValue; echo $string . '|'; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/XjlG2
function name:  (null)
number of ops:  24
compiled vars:  !0 = $xml, !1 = $xmldoc, !2 = $xpath, !3 = $query, !4 = $node, !5 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, '%0A%3Cmain%3E%0A%3Cdiv+class%3D%22DetailsPanel%22%3E%0A++++%3Clabel+class%3D%22ListLabel+left%22%3ELocation%3C%2Flabel%3E%0A++++%3Cspan+id%3D%22location%22+class%3D%22ListDetail+left%22+title%3D%22London%2C+UK%22%3ELondon%2C+UK%3C%2Fspan%3E%0A+++++%3Clabel+class%3D%22ListLabel+left%22%3EPrice%3C%2Flabel%3E%0A++++%3Cspan+id%3D%22price%22+class%3D%22ListDetail+left%22+title%3D%22%C2%A35000%22%3E%C2%A35000%3C%2Fspan%3E%0A++++%3Clabel+class%3D%22ListLabel+left%22%3ESector%3C%2Flabel%3E%0A++++%3Cspan+class%3D%22ListDetail+left%22%3E%0A++++++%3Ca+href%3D%22%2F%22%3EIT%3C%2Fa%3E%0A++++++%3Ca+href%3D%22%2F%22%3EICT%3C%2Fa%3E%0A++++%3C%2Fspan%3E%0A%3C%2Fdiv%3E%0A%0A%3Cdiv+class%3D%22DetailsPanel%22%3E%0A++++%3Clabel+class%3D%22ListLabel+left%22%3ELocation%3C%2Flabel%3E%0A++++%3Cspan+id%3D%22location%22+class%3D%22ListDetail+left%22+title%3D%22London%2C+UK%22%3ELondon%2C+UK%3C%2Fspan%3E%0A+++++%3Clabel+class%3D%22ListLabel+left%22%3EPrice%3C%2Flabel%3E%0A++++%3Cspan+id%3D%22price%22+class%3D%22ListDetail+left%22+title%3D%22%C2%A35000%22%3E%C2%A35000%3C%2Fspan%3E%0A++++%3Clabel+class%3D%22ListLabel+left%22%3ESector%3C%2Flabel%3E%0A++++%3Cspan+class%3D%22ListDetail+left%22%3E%0A++++++%3Ca+href%3D%22%2F%22%3EIT%3C%2Fa%3E%0A++++++%3Ca+href%3D%22%2F%22%3EICT%3C%2Fa%3E%0A++++%3C%2Fspan%3E%0A%3C%2Fdiv%3E%0A%3C%2Fmain%3E%0A%0A'
   34     1        NEW                                              $7      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $7
   36     4        INIT_METHOD_CALL                                         !1, 'loadXML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   38     7        NEW                                              $11     'Domxpath'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $11
   39    11        ASSIGN                                                   !3, '%2F%2Fdiv%5B%40class%3D%27DetailsPanel%27%5D'
   41    12        INIT_METHOD_CALL                                         !2, 'query'
         13        SEND_VAR_EX                                              !3
         14        DO_FCALL                                      0  $15     
         15      > FE_RESET_R                                       $16     $15, ->22
         16    > > FE_FETCH_R                                               $16, !4, ->22
   43    17    >   FETCH_OBJ_R                                      ~17     !4, 'nodeValue'
         18        ASSIGN                                                   !5, ~17
   44    19        CONCAT                                           ~19     !5, '%7C'
         20        ECHO                                                     ~19
   41    21      > JMP                                                      ->16
         22    >   FE_FREE                                                  $16
   48    23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.26 ms | 1390 KiB | 13 Q