3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<table> <tbody> <tr><tr> <tr> <td> <table class="style124"> <tbody> <tr> <td>A</td> </tr> <tr> <td>B</td> //THIS !! </tr> </tbody> </table> </td> </tr> <tr></tr> </tbody> </table>'; $dom = new DOMDocument; $dom->loadHTML($html); $xpath = new DOMXPath($dom); $query = '//table[contains(@class, "style124")]/tbody/tr[2]/td'; $entries = $xpath->query($query); foreach($entries as $entry){ echo $entry->nodeValue; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 21
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/pDFhB
function name:  (null)
number of ops:  23
compiled vars:  !0 = $html, !1 = $dom, !2 = $xpath, !3 = $query, !4 = $entries, !5 = $entry
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Ctable%3E%0A++%3Ctbody%3E%0A++++%3Ctr%3E%3Ctr%3E%0A++++%3Ctr%3E%0A++++++++%3Ctd%3E+%0A++++++++++++%3Ctable+class%3D%22style124%22%3E%0A++++++++++++++++%3Ctbody%3E%0A++++++++++++++++++++%3Ctr%3E%0A++++++++++++++++++++++++%3Ctd%3EA%3C%2Ftd%3E%0A++++++++++++++++++++%3C%2Ftr%3E%0A++++++++++++++++++++%3Ctr%3E%0A++++++++++++++++++++++++%3Ctd%3EB%3C%2Ftd%3E+%2F%2FTHIS+%21%21%0A++++++++++++++++++++%3C%2Ftr%3E%0A++++++++++++++++%3C%2Ftbody%3E%0A++++++++++++%3C%2Ftable%3E%0A++++++++%3C%2Ftd%3E%0A++++%3C%2Ftr%3E%0A++++%3Ctr%3E%3C%2Ftr%3E%0A++%3C%2Ftbody%3E%0A%3C%2Ftable%3E'
   22     1        NEW                                              $7      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $7
   23     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   24     7        NEW                                              $11     'DOMXPath'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $11
   25    11        ASSIGN                                                   !3, '%2F%2Ftable%5Bcontains%28%40class%2C+%22style124%22%29%5D%2Ftbody%2Ftr%5B2%5D%2Ftd'
   26    12        INIT_METHOD_CALL                                         !2, 'query'
         13        SEND_VAR_EX                                              !3
         14        DO_FCALL                                      0  $15     
         15        ASSIGN                                                   !4, $15
   27    16      > FE_RESET_R                                       $17     !4, ->21
         17    > > FE_FETCH_R                                               $17, !5, ->21
   28    18    >   FETCH_OBJ_R                                      ~18     !5, 'nodeValue'
         19        ECHO                                                     ~18
   27    20      > JMP                                                      ->17
         21    >   FE_FREE                                                  $17
   29    22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.17 ms | 1003 KiB | 13 Q