3v4l.org

run code in 300+ 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 = 52
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 52
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 45
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
filename:       /in/vECil
function name:  (null)
number of ops:  57
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, ->52
         21    > > FE_FETCH_R                                       ~19     $18, !4, ->52
         22    >   ASSIGN                                                   !5, ~19
   86    23        MOD                                              ~21     !5, 2
         24        IS_EQUAL                                                 ~21, 0
         25      > JMPZ                                                     ~22, ->45
   87    26    >   INIT_FCALL                                               'strtolower'
         27        INIT_FCALL                                               'trim'
         28        FETCH_OBJ_R                                      ~23     !4, 'nodeValue'
         29        SEND_VAL                                                 ~23
         30        DO_ICALL                                         $24     
         31        SEND_VAR                                                 $24
         32        DO_ICALL                                         $25     
         33        ASSIGN                                                   !6, $25
   88    34        INIT_FCALL                                               'str_replace'
         35        SEND_VAL                                                 '-'
         36        SEND_VAL                                                 '+'
         37        INIT_FCALL                                               'trim'
         38        SEND_VAR                                                 !6
         39        SEND_VAL                                                 '%3A'
         40        DO_ICALL                                         $27     
         41        SEND_VAR                                                 $27
         42        DO_ICALL                                         $28     
         43        ASSIGN                                                   !6, $28
   86    44      > JMP                                                      ->51
   90    45    >   INIT_FCALL                                               'trim'
         46        FETCH_OBJ_R                                      ~31     !4, 'nodeValue'
         47        SEND_VAL                                                 ~31
         48        DO_ICALL                                         $32     
         49        ASSIGN_DIM                                               !3, !6
         50        OP_DATA                                                  $32
   85    51    > > JMP                                                      ->21
         52    >   FE_FREE                                                  $18
   94    53        INIT_FCALL                                               'print_r'
         54        SEND_VAR                                                 !3
         55        DO_ICALL                                                 
         56      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.82 ms | 1012 KiB | 19 Q