3v4l.org

run code in 500+ PHP versions simultaneously
<?php $html = <<<HTML <a class="profile-link" href="CompanyProfile.aspx?PID=4813&amp;country=211&amp;practicearea=0&amp;pagenum=" title="1-844-Iran-Law">Amin Alemohammad</a> HTML; $doc = new DOMDocument(); $doc->loadHTML($html); foreach($doc->getElementsByTagName('a') as $a) { if ($a->getAttribute('class') === 'profile-link') { $parts = explode('?', $a->getAttribute('href')); parse_str($parts[1], $output); echo 'Title: ' . $a->getAttribute('title') . '<br>'; echo 'Text: ' . $a->nodeValue . '<br>'; echo 'PID: ' . $output['PID']; // etc.. } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 44
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 44
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 43
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 43
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
filename:       /in/iC8Gr
function name:  (null)
number of ops:  46
compiled vars:  !0 = $html, !1 = $doc, !2 = $a, !3 = $parts, !4 = $output
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%3Ca+class%3D%22profile-link%22+href%3D%22CompanyProfile.aspx%3FPID%3D4813%26amp%3Bcountry%3D211%26amp%3Bpracticearea%3D0%26amp%3Bpagenum%3D%22+title%3D%221-844-Iran-Law%22%3EAmin+Alemohammad%3C%2Fa%3E'
    6     1        NEW                                                  $6      'DOMDocument'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !1, $6
    7     4        INIT_METHOD_CALL                                             !1, 'loadHTML'
          5        SEND_VAR_EX                                                  !0
          6        DO_FCALL                                          0          
    8     7        INIT_METHOD_CALL                                             !1, 'getElementsByTagName'
          8        SEND_VAL_EX                                                  'a'
          9        DO_FCALL                                          0  $10     
         10      > FE_RESET_R                                           $11     $10, ->44
         11    > > FE_FETCH_R                                                   $11, !2, ->44
    9    12    >   INIT_METHOD_CALL                                             !2, 'getAttribute'
         13        SEND_VAL_EX                                                  'class'
         14        DO_FCALL                                          0  $12     
         15        IS_IDENTICAL                                                 $12, 'profile-link'
         16      > JMPZ                                                         ~13, ->43
   10    17    >   INIT_FCALL                                                   'explode'
         18        SEND_VAL                                                     '%3F'
         19        INIT_METHOD_CALL                                             !2, 'getAttribute'
         20        SEND_VAL_EX                                                  'href'
         21        DO_FCALL                                          0  $14     
         22        SEND_VAR                                                     $14
         23        DO_ICALL                                             $15     
         24        ASSIGN                                                       !3, $15
   11    25        INIT_FCALL                                                   'parse_str'
         26        FETCH_DIM_R                                          ~17     !3, 1
         27        SEND_VAL                                                     ~17
         28        SEND_REF                                                     !4
         29        DO_ICALL                                                     
   13    30        INIT_METHOD_CALL                                             !2, 'getAttribute'
         31        SEND_VAL_EX                                                  'title'
         32        DO_FCALL                                          0  $19     
         33        CONCAT                                               ~20     'Title%3A+', $19
         34        CONCAT                                               ~21     ~20, '%3Cbr%3E'
         35        ECHO                                                         ~21
   14    36        FETCH_OBJ_R                                          ~22     !2, 'nodeValue'
         37        CONCAT                                               ~23     'Text%3A+', ~22
         38        CONCAT                                               ~24     ~23, '%3Cbr%3E'
         39        ECHO                                                         ~24
   15    40        FETCH_DIM_R                                          ~25     !4, 'PID'
         41        CONCAT                                               ~26     'PID%3A+', ~25
         42        ECHO                                                         ~26
    8    43    > > JMP                                                          ->11
         44    >   FE_FREE                                                      $11
   18    45      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
205.66 ms | 2636 KiB | 15 Q