3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = ' <table id="myTable"> <tbody> <tr> <td>08/20/18</td> <td> <a href="https://example.com/1a">Text 1 A</a> </td> <td> <a href="https://example.com/1b">Test 1 B</a> </td> </tr> <tr> <td>08/21/18</td> <td> <a href="https://example.com/2a">Text 2 A</a> </td> <td> <a href="https://example.com/2b">Test 2 B</a> </td> </tr> </tbody> </table> '; // setup DOMDocument $doc = new DOMDocument(); $doc->loadHTML('<?xml encoding="utf-8" ?>' . $html); $xpath = new DOMXPath($doc); // target table using xpath $results = $xpath->query("//*[@id='myTable']"); if ($results->length > 0) { // Results object print_r($results->item(0)); // Results nodeValue print_r($results->item(0)->nodeValue); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 32
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/MYUdP
function name:  (null)
number of ops:  33
compiled vars:  !0 = $html, !1 = $doc, !2 = $xpath, !3 = $results
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%0A%3Ctable+id%3D%22myTable%22%3E%0A++++%3Ctbody%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3E08%2F20%2F18%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E+%3Ca+href%3D%22https%3A%2F%2Fexample.com%2F1a%22%3EText+1+A%3C%2Fa%3E+%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E+%3Ca+href%3D%22https%3A%2F%2Fexample.com%2F1b%22%3ETest+1+B%3C%2Fa%3E+%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3E08%2F21%2F18%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E+%3Ca+href%3D%22https%3A%2F%2Fexample.com%2F2a%22%3EText+2+A%3C%2Fa%3E+%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E+%3Ca+href%3D%22https%3A%2F%2Fexample.com%2F2b%22%3ETest+2+B%3C%2Fa%3E+%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++%3C%2Ftbody%3E%0A%3C%2Ftable%3E%0A'
   21     1        NEW                                              $5      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
   22     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        CONCAT                                           ~8      '%3C%3Fxml+encoding%3D%22utf-8%22+%3F%3E', !0
          6        SEND_VAL_EX                                              ~8
          7        DO_FCALL                                      0          
   23     8        NEW                                              $10     'DOMXPath'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $10
   25    12        INIT_METHOD_CALL                                         !2, 'query'
         13        SEND_VAL_EX                                              '%2F%2F%2A%5B%40id%3D%27myTable%27%5D'
         14        DO_FCALL                                      0  $13     
         15        ASSIGN                                                   !3, $13
   27    16        FETCH_OBJ_R                                      ~15     !3, 'length'
         17        IS_SMALLER                                               0, ~15
         18      > JMPZ                                                     ~16, ->32
   29    19    >   INIT_FCALL                                               'print_r'
         20        INIT_METHOD_CALL                                         !3, 'item'
         21        SEND_VAL_EX                                              0
         22        DO_FCALL                                      0  $17     
         23        SEND_VAR                                                 $17
         24        DO_ICALL                                                 
   31    25        INIT_FCALL                                               'print_r'
         26        INIT_METHOD_CALL                                         !3, 'item'
         27        SEND_VAL_EX                                              0
         28        DO_FCALL                                      0  $19     
         29        FETCH_OBJ_R                                      ~20     $19, 'nodeValue'
         30        SEND_VAL                                                 ~20
         31        DO_ICALL                                                 
   32    32    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.44 ms | 1011 KiB | 14 Q