3v4l.org

run code in 500+ PHP versions simultaneously
<?php $html = "<tr class='unknown another' id='no idea'> <td attribute='no idea' class='no idea'>Some Marker I know<td> <label>This is what I want</label> <tr>"; $doc = new DomDocument; $doc->loadHTML($html); $xpath = new DomXPath($doc); $marker = $xpath->query('//*[text()="Some Marker I know"]/following-sibling::*'); echo(trim($marker[0]->nodeValue));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JBHI6
function name:  (null)
number of ops:  20
compiled vars:  !0 = $html, !1 = $doc, !2 = $xpath, !3 = $marker
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%3Ctr+class%3D%27unknown+another%27+id%3D%27no+idea%27%3E%0A++++%3Ctd+attribute%3D%27no+idea%27+class%3D%27no+idea%27%3ESome+Marker+I+know%3Ctd%3E%0A++++%3Clabel%3EThis+is+what+I+want%3C%2Flabel%3E%0A%3Ctr%3E'
    6     1        NEW                                                  $5      'DomDocument'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !1, $5
    7     4        INIT_METHOD_CALL                                             !1, 'loadHTML'
          5        SEND_VAR_EX                                                  !0
          6        DO_FCALL                                          0          
    8     7        NEW                                                  $9      'DomXPath'
          8        SEND_VAR_EX                                                  !1
          9        DO_FCALL                                          0          
         10        ASSIGN                                                       !2, $9
    9    11        INIT_METHOD_CALL                                             !2, 'query'
         12        SEND_VAL_EX                                                  '%2F%2F%2A%5Btext%28%29%3D%22Some+Marker+I+know%22%5D%2Ffollowing-sibling%3A%3A%2A'
         13        DO_FCALL                                          0  $12     
         14        ASSIGN                                                       !3, $12
   10    15        FETCH_DIM_R                                          ~14     !3, 0
         16        FETCH_OBJ_R                                          ~15     ~14, 'nodeValue'
         17        FRAMELESS_ICALL_1                trim                ~16     ~15
         18        ECHO                                                         ~16
         19      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.73 ms | 2550 KiB | 13 Q