3v4l.org

run code in 500+ PHP versions simultaneously
<?php $desc = '<a href="http://mywebsite.com" cat_id="156" tab-id="3">My name</a><a href="http://mywebsite.com" cat_id="111" tab-id="4">My name 2</a>'; $dom = new DOMDocument(); $dom->loadHTML($desc); foreach ($dom->getElementsByTagName("a") as $element) { echo $element->getAttribute("cat_id"); echo "<br>"; echo $element->getAttribute("tab-id"); echo "<br>"; echo $element->nodeValue; echo "<br>"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 26
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 26
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/4C9uh
function name:  (null)
number of ops:  28
compiled vars:  !0 = $desc, !1 = $dom, !2 = $element
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%3Ca+href%3D%22http%3A%2F%2Fmywebsite.com%22+cat_id%3D%22156%22+tab-id%3D%223%22%3EMy+name%3C%2Fa%3E%3Ca+href%3D%22http%3A%2F%2Fmywebsite.com%22+cat_id%3D%22111%22+tab-id%3D%224%22%3EMy+name+2%3C%2Fa%3E'
    4     1        NEW                                                  $4      'DOMDocument'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !1, $4
    5     4        INIT_METHOD_CALL                                             !1, 'loadHTML'
          5        SEND_VAR_EX                                                  !0
          6        DO_FCALL                                          0          
    7     7        INIT_METHOD_CALL                                             !1, 'getElementsByTagName'
          8        SEND_VAL_EX                                                  'a'
          9        DO_FCALL                                          0  $8      
         10      > FE_RESET_R                                           $9      $8, ->26
         11    > > FE_FETCH_R                                                   $9, !2, ->26
    8    12    >   INIT_METHOD_CALL                                             !2, 'getAttribute'
         13        SEND_VAL_EX                                                  'cat_id'
         14        DO_FCALL                                          0  $10     
         15        ECHO                                                         $10
    9    16        ECHO                                                         '%3Cbr%3E'
   10    17        INIT_METHOD_CALL                                             !2, 'getAttribute'
         18        SEND_VAL_EX                                                  'tab-id'
         19        DO_FCALL                                          0  $11     
         20        ECHO                                                         $11
   11    21        ECHO                                                         '%3Cbr%3E'
   12    22        FETCH_OBJ_R                                          ~12     !2, 'nodeValue'
         23        ECHO                                                         ~12
   13    24        ECHO                                                         '%3Cbr%3E'
    7    25      > JMP                                                          ->11
         26    >   FE_FREE                                                      $9
   14    27      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.46 ms | 2541 KiB | 12 Q