3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<table><tr> <td>DATA 1</td> <td><a href="12345">DATA 2</a></td> <td>DATA 3</td> </tr></table>'; $dom = new DOMDocument; $dom->loadHTML($html); foreach ($dom->getElementsByTagName('td') as $node) { $nodeAnchor = $node->getElementsByTagName("a"); if ($nodeAnchor->length) $array_data[] = $nodeAnchor->item(0)->getAttribute("href"); $array_data[] = $node->nodeValue; } print_r($array_data);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 30
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 30
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 26
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 26
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/Ulc3A
function name:  (null)
number of ops:  35
compiled vars:  !0 = $html, !1 = $dom, !2 = $node, !3 = $nodeAnchor, !4 = $array_data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Ctable%3E%3Ctr%3E%0A%3Ctd%3EDATA+1%3C%2Ftd%3E%0A%3Ctd%3E%3Ca+href%3D%2212345%22%3EDATA+2%3C%2Fa%3E%3C%2Ftd%3E%0A%3Ctd%3EDATA+3%3C%2Ftd%3E+%0A%3C%2Ftr%3E%3C%2Ftable%3E'
    8     1        NEW                                              $6      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $6
    9     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   10     7        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
          8        SEND_VAL_EX                                              'td'
          9        DO_FCALL                                      0  $10     
         10      > FE_RESET_R                                       $11     $10, ->30
         11    > > FE_FETCH_R                                               $11, !2, ->30
   11    12    >   INIT_METHOD_CALL                                         !2, 'getElementsByTagName'
         13        SEND_VAL_EX                                              'a'
         14        DO_FCALL                                      0  $12     
         15        ASSIGN                                                   !3, $12
   12    16        FETCH_OBJ_R                                      ~14     !3, 'length'
         17      > JMPZ                                                     ~14, ->26
   13    18    >   INIT_METHOD_CALL                                         !3, 'item'
         19        SEND_VAL_EX                                              0
         20        DO_FCALL                                      0  $16     
         21        INIT_METHOD_CALL                                         $16, 'getAttribute'
         22        SEND_VAL_EX                                              'href'
         23        DO_FCALL                                      0  $17     
         24        ASSIGN_DIM                                               !4
         25        OP_DATA                                                  $17
   14    26    >   FETCH_OBJ_R                                      ~19     !2, 'nodeValue'
         27        ASSIGN_DIM                                               !4
         28        OP_DATA                                                  ~19
   10    29      > JMP                                                      ->11
         30    >   FE_FREE                                                  $11
   17    31        INIT_FCALL                                               'print_r'
         32        SEND_VAR                                                 !4
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.91 ms | 1011 KiB | 14 Q