3v4l.org

run code in 500+ PHP versions simultaneously
<?php $html = '<table style="color:; text-align: left;"> <tr> <td> Processor: </td> <td> Intel Core 2 Duo - E8400 </td> </tr> <tr> <td> Clock speed: </td> <td> 3.0 GHz </td> </tr> <tr> <td> Memory: </td> <td> 4 GB </td> </tr> <tr> <td> Hard disk: </td> <td> 250 GB </td> </tr> <tr> <td> Video-adapter: </td> <td> VGA, Display </td> </tr> <tr> <td> Netwerk card: </td> <td> 1000 Mbps LAN </td> </tr> <tr> <td> Optical drive: </td> <td> DVD-Rewriter </td> </tr> <tr> <td> Operating system: </td> <td> Windows 7 or 10 Pro </td> </tr> <tr> <td> Warranty: </td> <td> 1 year </td> </tr> </table>'; $err = libxml_use_internal_errors(true); $dom = new DOMDocument(); $dom->loadHTML($html); libxml_clear_errors(); libxml_use_internal_errors($err); // $result = []; foreach ($dom->getElementsByTagName('td') as $i => $tr) { if ($i % 2 == 0) { $key = strtolower(trim($tr->nodeValue)); $key = str_replace('-', ' ', trim($key, ':')); } else { $result[$key] = trim($tr->nodeValue); } } print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 42
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 42
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 37
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
filename:       /in/vECil
function name:  (null)
number of ops:  47
compiled vars:  !0 = $html, !1 = $err, !2 = $dom, !3 = $result, !4 = $tr, !5 = $i, !6 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%3Ctable+style%3D%22color%3A%3B+text-align%3A+left%3B%22%3E%0A%3Ctr%3E%0A%3Ctd%3E%0AProcessor%3A%0A%3C%2Ftd%3E%0A%3Ctd%3E%0A++++++++Intel+Core+2+Duo+-+E8400%0A%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A%3Ctd%3E%0AClock+speed%3A%0A%3C%2Ftd%3E%0A%3Ctd%3E%0A++++++++3.0+GHz%0A%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A%3Ctd%3E%0AMemory%3A%0A%3C%2Ftd%3E%0A%3Ctd%3E%0A++++++++4+GB%0A%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A%3Ctd%3E%0AHard+disk%3A%0A%3C%2Ftd%3E%0A%3Ctd%3E%0A++++++++250+GB%0A%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A%3Ctd%3E%0AVideo-adapter%3A%0A%3C%2Ftd%3E%0A%3Ctd%3E%0A++++++++VGA%2C+Display%0A%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A%3Ctd%3E%0ANetwerk+card%3A%0A%3C%2Ftd%3E%0A%3Ctd%3E%0A++++++++1000+Mbps+LAN%0A%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A%3Ctd%3E%0AOptical+drive%3A%0A%3C%2Ftd%3E%0A%3Ctd%3E%0A++++++++DVD-Rewriter%0A%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A%3Ctd%3E%0AOperating+system%3A%0A%3C%2Ftd%3E%0A%3Ctd%3E%0A++++++++Windows+7+or+10+Pro%0A%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A%3Ctd%3E%0AWarranty%3A%0A%3C%2Ftd%3E%0A%3Ctd%3E%0A++++++++1+year%0A%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3C%2Ftable%3E'
   77     1        INIT_FCALL                                                   'libxml_use_internal_errors'
          2        SEND_VAL                                                     <true>
          3        DO_ICALL                                             $8      
          4        ASSIGN                                                       !1, $8
   78     5        NEW                                                  $10     'DOMDocument'
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !2, $10
   79     8        INIT_METHOD_CALL                                             !2, 'loadHTML'
          9        SEND_VAR_EX                                                  !0
         10        DO_FCALL                                          0          
   80    11        INIT_FCALL                                                   'libxml_clear_errors'
         12        DO_ICALL                                                     
   81    13        INIT_FCALL                                                   'libxml_use_internal_errors'
         14        SEND_VAR                                                     !1
         15        DO_ICALL                                                     
   84    16        ASSIGN                                                       !3, <array>
   85    17        INIT_METHOD_CALL                                             !2, 'getElementsByTagName'
         18        SEND_VAL_EX                                                  'td'
         19        DO_FCALL                                          0  $17     
         20      > FE_RESET_R                                           $18     $17, ->42
         21    > > FE_FETCH_R                                           ~19     $18, !4, ->42
         22    >   ASSIGN                                                       !5, ~19
   86    23        MOD                                                  ~21     !5, 2
         24        IS_EQUAL                                                     ~21, 0
         25      > JMPZ                                                         ~22, ->37
   87    26    >   INIT_FCALL                                                   'strtolower'
         27        FETCH_OBJ_R                                          ~23     !4, 'nodeValue'
         28        FRAMELESS_ICALL_1                trim                ~24     ~23
         29        SEND_VAL                                                     ~24
         30        DO_ICALL                                             $25     
         31        ASSIGN                                                       !6, $25
   88    32        FRAMELESS_ICALL_2                trim                ~27     !6, '%3A'
         33        FRAMELESS_ICALL_3                str_replace         ~28     '-', '+'
         34        OP_DATA                                                      ~27
         35        ASSIGN                                                       !6, ~28
   86    36      > JMP                                                          ->41
   90    37    >   FETCH_OBJ_R                                          ~31     !4, 'nodeValue'
         38        FRAMELESS_ICALL_1                trim                ~32     ~31
         39        ASSIGN_DIM                                                   !3, !6
         40        OP_DATA                                                      ~32
   85    41    > > JMP                                                          ->21
         42    >   FE_FREE                                                      $18
   94    43        INIT_FCALL                                                   'print_r'
         44        SEND_VAR                                                     !3
         45        DO_ICALL                                                     
         46      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162 ms | 2189 KiB | 17 Q