3v4l.org

run code in 300+ PHP versions simultaneously
<?php class tableutils{ static function compareByName($a, $b){ return strcmp($a, $b); } static function tabella_riassunto ($valori,$cell1,$sort=true,$arr=false,$className='tabella_riassunto',$tot_righe=true,$classi="",$links=""){ /* Scorro l'array per trovare tutte le colonne possibili * TODO: esiste un modo piĆ¹ elegante? */ foreach ($valori as $key => $val) { foreach ($val as $kr => $vr) $col[$kr] = $kr; } if($sort) { sort($col); uksort($valori, 'tableutils::compareByName'); } /* Inizio a scrivere la tabella*/ $table="<table class=\"$className\" celpadding=\"0\" cellspacing=\"0\">"; /* Scrivo le intestazioni */ $table .="<tr>"; $table .="<th>$cell1</th>"; $rex[0][] = $cell1; /* Scrivo le intestazioni */ foreach ($col as $c) { $table .="<th>".$c."</th>";$rex[0][] = $c; } /* Questa colonna serve per i totali */ if($tot_righe) $table .="<th>TOTALE</th>"; //else $table .="<th></th>"; $table .="</tr>"; if($tot_righe)$rex[0][] = "TOTALE"; /* Ciclo l'array*/ $count = 1; foreach ($valori as $key => $val) { $tot1=0; $table .="<tr>"; $table .="<td class=\"nomi\">".$key."</td>"; $rex[$count][] = $key; $count_col=1; foreach ($col as $c){ if($links[$key][$c]){ if($classi[$count_col]) $table .="<td class=\"".$classi[$count_col]."\"><a href='".$links[$key][$c]."'>".$val[$c]."</a></td>"; else $table .="<td><a href='".$links[$key][$c]."'>".$val[$c]."</a></td>"; } else { if($classi[$count_col]) $table .="<td class=\"".$classi[$count_col]."\">".$val[$c]."</td>"; else $table .="<td>".$val[$c]."</td>"; } $rex[$count][] = $val[$c]; /* Faccio la somma dei valori degli elementi della riga */ $tot1 += $val[$c]; /* Faccio la somma usando come indice il nome della colonna */ $tot2[$c] += $val[$c]; $count_col++; } if($tot_righe){ $table .="<td class=\"tot1\">".$tot1."</td>"; //else $table .="<td class=\"tot1\"></td>"; $rex[$count][] = $tot1; } $table .="</tr>"; $count++; } /* Scrivo la somma salvata precedentemente*/ $table .="<tr>"; $table .="<td class=\"tot1\">TOTALE</td>"; $rex[$count][] = "TOTALE"; foreach ($tot2 as $t){ $table .="<td class=\"tot1\">".$t."</td>"; $rex[$count][] = $t; $tot += $t; } if($tot_righe){ $table .="<td class=\"totfinal\">".$tot."</td>"; $rex[$count][] = $tot; } $table .="</tr>"; $table .="</table>"; if($arr) return $rex; else return $table; } } $arr = array("052 VARICELLA" => array("2015 m focolai" => 1, "2015 casi coinvolti" => 3)); tableutils::tabella_riassunto($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vk5s1
function name:  (null)
number of ops:  5
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   96     0  E >   ASSIGN                                                   !0, <array>
   98     1        INIT_STATIC_METHOD_CALL                                  'tableutils', 'tabella_riassunto'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Class tableutils:
Function comparebyname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vk5s1
function name:  compareByName
number of ops:  8
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_FCALL                                               'strcmp'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
    7     7*     > RETURN                                                   null

End of function comparebyname

Function tabella_riassunto:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 19
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 19
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 17
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 28
Branch analysis from position: 21
2 jumps found. (Code = 77) Position 1 = 41, Position 2 = 49
Branch analysis from position: 41
2 jumps found. (Code = 78) Position 1 = 42, Position 2 = 49
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 52
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 57
Branch analysis from position: 54
2 jumps found. (Code = 77) Position 1 = 59, Position 2 = 134
Branch analysis from position: 59
2 jumps found. (Code = 78) Position 1 = 60, Position 2 = 134
Branch analysis from position: 60
2 jumps found. (Code = 77) Position 1 = 71, Position 2 = 123
Branch analysis from position: 71
2 jumps found. (Code = 78) Position 1 = 72, Position 2 = 123
Branch analysis from position: 72
2 jumps found. (Code = 43) Position 1 = 75, Position 2 = 98
Branch analysis from position: 75
2 jumps found. (Code = 43) Position 1 = 77, Position 2 = 89
Branch analysis from position: 77
1 jumps found. (Code = 42) Position 1 = 97
Branch analysis from position: 97
1 jumps found. (Code = 42) Position 1 = 112
Branch analysis from position: 112
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
Branch analysis from position: 89
1 jumps found. (Code = 42) Position 1 = 112
Branch analysis from position: 112
Branch analysis from position: 98
2 jumps found. (Code = 43) Position 1 = 100, Position 2 = 108
Branch analysis from position: 100
1 jumps found. (Code = 42) Position 1 = 112
Branch analysis from position: 112
Branch analysis from position: 108
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
Branch analysis from position: 123
2 jumps found. (Code = 43) Position 1 = 125, Position 2 = 131
Branch analysis from position: 125
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
Branch analysis from position: 131
Branch analysis from position: 123
Branch analysis from position: 134
2 jumps found. (Code = 77) Position 1 = 141, Position 2 = 150
Branch analysis from position: 141
2 jumps found. (Code = 78) Position 1 = 142, Position 2 = 150
Branch analysis from position: 142
1 jumps found. (Code = 42) Position 1 = 141
Branch analysis from position: 141
Branch analysis from position: 150
2 jumps found. (Code = 43) Position 1 = 152, Position 2 = 158
Branch analysis from position: 152
2 jumps found. (Code = 43) Position 1 = 161, Position 2 = 163
Branch analysis from position: 161
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 163
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 158
Branch analysis from position: 150
Branch analysis from position: 134
Branch analysis from position: 57
Branch analysis from position: 52
Branch analysis from position: 49
Branch analysis from position: 28
Branch analysis from position: 19
filename:       /in/vk5s1
function name:  tabella_riassunto
number of ops:  165
compiled vars:  !0 = $valori, !1 = $cell1, !2 = $sort, !3 = $arr, !4 = $className, !5 = $tot_righe, !6 = $classi, !7 = $links, !8 = $val, !9 = $key, !10 = $vr, !11 = $kr, !12 = $col, !13 = $table, !14 = $rex, !15 = $c, !16 = $count, !17 = $tot1, !18 = $count_col, !19 = $tot2, !20 = $t, !21 = $tot
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <true>
          3        RECV_INIT                                        !3      <false>
          4        RECV_INIT                                        !4      'tabella_riassunto'
          5        RECV_INIT                                        !5      <true>
          6        RECV_INIT                                        !6      ''
          7        RECV_INIT                                        !7      ''
   14     8      > FE_RESET_R                                       $22     !0, ->19
          9    > > FE_FETCH_R                                       ~23     $22, !8, ->19
         10    >   ASSIGN                                                   !9, ~23
         11      > FE_RESET_R                                       $25     !8, ->17
         12    > > FE_FETCH_R                                       ~26     $25, !10, ->17
         13    >   ASSIGN                                                   !11, ~26
         14        ASSIGN_DIM                                               !12, !11
         15        OP_DATA                                                  !11
         16      > JMP                                                      ->12
         17    >   FE_FREE                                                  $25
         18      > JMP                                                      ->9
         19    >   FE_FREE                                                  $22
   16    20      > JMPZ                                                     !2, ->28
   17    21    >   INIT_FCALL                                               'sort'
         22        SEND_REF                                                 !12
         23        DO_ICALL                                                 
   18    24        INIT_FCALL                                               'uksort'
         25        SEND_REF                                                 !0
         26        SEND_VAL                                                 'tableutils%3A%3AcompareByName'
         27        DO_ICALL                                                 
   22    28    >   ROPE_INIT                                     3  ~32     '%3Ctable+class%3D%22'
         29        ROPE_ADD                                      1  ~32     ~32, !4
         30        ROPE_END                                      2  ~31     ~32, '%22+celpadding%3D%220%22+cellspacing%3D%220%22%3E'
         31        ASSIGN                                                   !13, ~31
   25    32        ASSIGN_OP                                     8          !13, '%3Ctr%3E'
   26    33        ROPE_INIT                                     3  ~37     '%3Cth%3E'
         34        ROPE_ADD                                      1  ~37     ~37, !1
         35        ROPE_END                                      2  ~36     ~37, '%3C%2Fth%3E'
         36        ASSIGN_OP                                     8          !13, ~36
   27    37        FETCH_DIM_W                                      $40     !14, 0
         38        ASSIGN_DIM                                               $40
         39        OP_DATA                                                  !1
   30    40      > FE_RESET_R                                       $42     !12, ->49
         41    > > FE_FETCH_R                                               $42, !15, ->49
         42    >   CONCAT                                           ~43     '%3Cth%3E', !15
         43        CONCAT                                           ~44     ~43, '%3C%2Fth%3E'
         44        ASSIGN_OP                                     8          !13, ~44
         45        FETCH_DIM_W                                      $46     !14, 0
         46        ASSIGN_DIM                                               $46
         47        OP_DATA                                                  !15
         48      > JMP                                                      ->41
         49    >   FE_FREE                                                  $42
   32    50      > JMPZ                                                     !5, ->52
         51    >   ASSIGN_OP                                     8          !13, '%3Cth%3ETOTALE%3C%2Fth%3E'
   34    52    >   ASSIGN_OP                                     8          !13, '%3C%2Ftr%3E'
   35    53      > JMPZ                                                     !5, ->57
         54    >   FETCH_DIM_W                                      $50     !14, 0
         55        ASSIGN_DIM                                               $50
         56        OP_DATA                                                  'TOTALE'
   37    57    >   ASSIGN                                                   !16, 1
   38    58      > FE_RESET_R                                       $53     !0, ->134
         59    > > FE_FETCH_R                                       ~54     $53, !8, ->134
         60    >   ASSIGN                                                   !9, ~54
   39    61        ASSIGN                                                   !17, 0
   40    62        ASSIGN_OP                                     8          !13, '%3Ctr%3E'
   41    63        CONCAT                                           ~58     '%3Ctd+class%3D%22nomi%22%3E', !9
         64        CONCAT                                           ~59     ~58, '%3C%2Ftd%3E'
         65        ASSIGN_OP                                     8          !13, ~59
   42    66        FETCH_DIM_W                                      $61     !14, !16
         67        ASSIGN_DIM                                               $61
         68        OP_DATA                                                  !9
   43    69        ASSIGN                                                   !18, 1
   44    70      > FE_RESET_R                                       $64     !12, ->123
         71    > > FE_FETCH_R                                               $64, !15, ->123
   47    72    >   FETCH_DIM_R                                      ~65     !7, !9
         73        FETCH_DIM_R                                      ~66     ~65, !15
         74      > JMPZ                                                     ~66, ->98
   48    75    >   FETCH_DIM_R                                      ~67     !6, !18
         76      > JMPZ                                                     ~67, ->89
         77    >   FETCH_DIM_R                                      ~68     !6, !18
         78        CONCAT                                           ~69     '%3Ctd+class%3D%22', ~68
         79        CONCAT                                           ~70     ~69, '%22%3E%3Ca++href%3D%27'
         80        FETCH_DIM_R                                      ~71     !7, !9
         81        FETCH_DIM_R                                      ~72     ~71, !15
         82        CONCAT                                           ~73     ~70, ~72
         83        CONCAT                                           ~74     ~73, '%27%3E'
         84        FETCH_DIM_R                                      ~75     !8, !15
         85        CONCAT                                           ~76     ~74, ~75
         86        CONCAT                                           ~77     ~76, '%3C%2Fa%3E%3C%2Ftd%3E'
         87        ASSIGN_OP                                     8          !13, ~77
         88      > JMP                                                      ->97
   49    89    >   FETCH_DIM_R                                      ~79     !7, !9
         90        FETCH_DIM_R                                      ~80     ~79, !15
         91        CONCAT                                           ~81     '%3Ctd%3E%3Ca+href%3D%27', ~80
         92        CONCAT                                           ~82     ~81, '%27%3E'
         93        FETCH_DIM_R                                      ~83     !8, !15
         94        CONCAT                                           ~84     ~82, ~83
         95        CONCAT                                           ~85     ~84, '%3C%2Fa%3E%3C%2Ftd%3E'
         96        ASSIGN_OP                                     8          !13, ~85
   47    97    > > JMP                                                      ->112
   52    98    >   FETCH_DIM_R                                      ~87     !6, !18
         99      > JMPZ                                                     ~87, ->108
        100    >   FETCH_DIM_R                                      ~88     !6, !18
        101        CONCAT                                           ~89     '%3Ctd+class%3D%22', ~88
        102        CONCAT                                           ~90     ~89, '%22%3E'
        103        FETCH_DIM_R                                      ~91     !8, !15
        104        CONCAT                                           ~92     ~90, ~91
        105        CONCAT                                           ~93     ~92, '%3C%2Ftd%3E'
        106        ASSIGN_OP                                     8          !13, ~93
        107      > JMP                                                      ->112
   53   108    >   FETCH_DIM_R                                      ~95     !8, !15
        109        CONCAT                                           ~96     '%3Ctd%3E', ~95
        110        CONCAT                                           ~97     ~96, '%3C%2Ftd%3E'
        111        ASSIGN_OP                                     8          !13, ~97
   56   112    >   FETCH_DIM_R                                      ~101    !8, !15
        113        FETCH_DIM_W                                      $99     !14, !16
        114        ASSIGN_DIM                                               $99
        115        OP_DATA                                                  ~101
   58   116        FETCH_DIM_R                                      ~102    !8, !15
        117        ASSIGN_OP                                     1          !17, ~102
   60   118        FETCH_DIM_R                                      ~105    !8, !15
        119        ASSIGN_DIM_OP                +=               1          !19, !15
        120        OP_DATA                                                  ~105
   61   121        PRE_INC                                                  !18
   44   122      > JMP                                                      ->71
        123    >   FE_FREE                                                  $64
   64   124      > JMPZ                                                     !5, ->131
        125    >   CONCAT                                           ~107    '%3Ctd+class%3D%22tot1%22%3E', !17
        126        CONCAT                                           ~108    ~107, '%3C%2Ftd%3E'
        127        ASSIGN_OP                                     8          !13, ~108
   66   128        FETCH_DIM_W                                      $110    !14, !16
        129        ASSIGN_DIM                                               $110
        130        OP_DATA                                                  !17
   68   131    >   ASSIGN_OP                                     8          !13, '%3C%2Ftr%3E'
   69   132        PRE_INC                                                  !16
   38   133      > JMP                                                      ->59
        134    >   FE_FREE                                                  $53
   72   135        ASSIGN_OP                                     8          !13, '%3Ctr%3E'
   73   136        ASSIGN_OP                                     8          !13, '%3Ctd++class%3D%22tot1%22%3ETOTALE%3C%2Ftd%3E'
   74   137        FETCH_DIM_W                                      $116    !14, !16
        138        ASSIGN_DIM                                               $116
        139        OP_DATA                                                  'TOTALE'
   75   140      > FE_RESET_R                                       $118    !19, ->150
        141    > > FE_FETCH_R                                               $118, !20, ->150
   76   142    >   CONCAT                                           ~119    '%3Ctd++class%3D%22tot1%22%3E', !20
        143        CONCAT                                           ~120    ~119, '%3C%2Ftd%3E'
        144        ASSIGN_OP                                     8          !13, ~120
   77   145        FETCH_DIM_W                                      $122    !14, !16
        146        ASSIGN_DIM                                               $122
        147        OP_DATA                                                  !20
   78   148        ASSIGN_OP                                     1          !21, !20
   75   149      > JMP                                                      ->141
        150    >   FE_FREE                                                  $118
   80   151      > JMPZ                                                     !5, ->158
   81   152    >   CONCAT                                           ~125    '%3Ctd++class%3D%22totfinal%22%3E', !21
        153        CONCAT                                           ~126    ~125, '%3C%2Ftd%3E'
        154        ASSIGN_OP                                     8          !13, ~126
   82   155        FETCH_DIM_W                                      $128    !14, !16
        156        ASSIGN_DIM                                               $128
        157        OP_DATA                                                  !21
   84   158    >   ASSIGN_OP                                     8          !13, '%3C%2Ftr%3E'
   85   159        ASSIGN_OP                                     8          !13, '%3C%2Ftable%3E'
   87   160      > JMPZ                                                     !3, ->163
        161    > > RETURN                                                   !14
        162*       JMP                                                      ->164
   88   163    > > RETURN                                                   !13
   89   164*     > RETURN                                                   null

End of function tabella_riassunto

End of class tableutils.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.36 ms | 1455 KiB | 16 Q