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);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.70.0110.00416.88
8.3.60.0030.01618.39
8.3.50.0120.00621.97
8.3.40.0070.01418.89
8.3.30.0040.01119.04
8.3.20.0080.00020.34
8.3.10.0030.00523.53
8.3.00.0050.00319.26
8.2.180.0110.00425.92
8.2.170.0100.01022.96
8.2.160.0030.01022.26
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0040.00419.49
8.2.110.0090.00021.18
8.2.100.0040.00717.84
8.2.90.0030.00617.91
8.2.80.0040.00418.22
8.2.70.0040.00417.63
8.2.60.0050.00317.50
8.2.50.0000.00818.10
8.2.40.0050.00220.58
8.2.30.0000.00919.14
8.2.20.0040.00417.79
8.2.10.0020.00518.16
8.2.00.0000.00817.87
8.1.280.0160.00025.92
8.1.270.0000.00818.92
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0090.00024.03
8.1.230.0060.00620.88
8.1.220.0000.00917.74
8.1.210.0030.00618.77
8.1.200.0030.00617.35
8.1.190.0030.00616.88
8.1.180.0030.00618.10
8.1.170.0030.00618.50
8.1.160.0030.00618.88
8.1.150.0040.00418.88
8.1.140.0040.00417.45
8.1.130.0030.00317.88
8.1.120.0040.00417.30
8.1.110.0050.00317.35
8.1.100.0040.00417.43
8.1.90.0050.00317.34
8.1.80.0050.00317.36
8.1.70.0030.00317.39
8.1.60.0060.00317.64
8.1.50.0030.00617.55
8.1.40.0030.00617.61
8.1.30.0030.00517.64
8.1.20.0000.00817.59
8.1.10.0020.00517.59
8.1.00.0050.00317.54
8.0.300.0000.00720.17
8.0.290.0030.00616.88
8.0.280.0000.00718.48
8.0.270.0000.00717.29
8.0.260.0060.00017.31
8.0.250.0070.00017.07
8.0.240.0060.00616.90
8.0.230.0000.00816.92
8.0.220.0000.00716.84
8.0.210.0040.00417.01
8.0.200.0070.00016.98
8.0.190.0060.00317.01
8.0.180.0040.00417.00
8.0.170.0050.00317.02
8.0.160.0030.00317.00
8.0.150.0030.00716.93
8.0.140.0000.00816.92
8.0.130.0030.00313.41
8.0.120.0030.00516.92
8.0.110.0050.00316.83
8.0.100.0040.00417.02
8.0.90.0040.00416.75
8.0.80.0090.00716.96
8.0.70.0040.00416.77
8.0.60.0030.00516.99
8.0.50.0000.00816.84
8.0.30.0160.00317.02
8.0.20.0080.01417.40
8.0.10.0030.00416.92
8.0.00.0100.00816.80
7.4.330.0020.00215.03
7.4.320.0000.00616.40
7.4.300.0030.00316.55
7.4.290.0000.00816.60
7.4.280.0080.00016.69
7.4.270.0000.00816.64
7.4.260.0000.00716.47
7.4.250.0040.00416.50
7.4.240.0020.00516.57
7.4.230.0030.00316.44
7.4.220.0070.01716.72
7.4.210.0110.00416.70
7.4.200.0030.00516.73
7.4.160.0040.01916.66
7.4.150.0100.00717.40
7.4.140.0070.01017.86
7.4.130.0110.00716.58
7.4.120.0110.00716.47
7.4.110.0110.00816.52
7.4.100.0130.01016.47
7.4.90.0150.00316.55
7.4.80.0110.00919.39
7.4.70.0130.00316.59
7.4.60.0080.01016.31
7.4.50.0050.00916.41
7.4.40.0030.01316.36
7.4.30.0000.02116.17
7.4.20.0070.01016.04
7.4.10.0060.01616.02
7.4.00.0070.01116.05
7.3.330.0030.00313.42
7.3.320.0030.00313.21
7.3.310.0000.00716.30
7.3.300.0040.00416.46
7.3.290.0100.00316.39
7.3.280.0120.00416.36
7.3.270.0070.01117.40
7.3.260.0170.00716.75
7.3.250.0120.00916.36
7.3.240.0080.01316.38
7.3.230.0120.00416.54
7.3.210.0070.01016.25
7.3.200.0130.01019.39
7.3.190.0060.01016.37
7.3.180.0080.00816.45
7.3.170.0050.01116.30
7.3.160.0110.00816.49
7.3.150.0110.01116.16
7.3.140.0030.01316.54
7.3.130.0060.01516.26
7.3.120.0050.01116.31
7.3.110.0140.00316.18
7.3.100.0070.01116.10
7.3.90.0070.01016.28
7.3.80.0140.00316.16
7.3.70.0090.00616.27
7.3.60.0060.01216.27
7.3.50.0080.00816.32
7.3.40.0090.00616.36
7.3.30.0070.01016.42
7.3.20.0100.00716.08
7.3.10.0130.01016.34
7.3.00.0140.00916.25
7.2.330.0130.00616.57
7.2.320.0170.00716.37
7.2.310.0070.01016.37
7.2.300.0040.01216.48
7.2.290.0130.00616.52
7.2.280.0030.01316.26
7.2.270.0120.00616.49
7.2.260.0190.00016.39
7.2.250.0090.01216.14
7.2.240.0140.00316.43
7.2.230.0090.01216.11
7.2.220.0100.00716.12
7.2.210.0080.00816.27
7.2.200.0060.01016.49
7.2.190.0060.01216.39
7.2.180.0140.00316.48
7.2.170.0130.00316.33
7.2.160.0110.00716.45
7.2.150.0100.01016.50
7.2.140.0170.01416.26
7.2.130.0200.00316.57
7.2.120.0110.00716.33
7.2.110.0030.01416.32
7.2.100.0000.01916.52
7.2.90.0110.00616.47
7.2.80.0120.00416.35
7.2.70.0070.01016.51
7.2.60.0020.01316.63
7.2.50.0130.00716.46
7.2.40.0120.00616.36
7.2.30.0040.01216.28
7.2.20.0100.00616.61
7.2.10.0030.01416.23
7.2.00.0080.00717.76
7.1.330.0070.01015.41
7.1.320.0030.01615.28
7.1.310.0100.01015.59
7.1.300.0070.00715.34
7.1.290.0060.00915.38
7.1.280.0090.00615.48
7.1.270.0120.00615.48
7.1.260.0070.01115.26
7.1.250.0230.00015.42
7.1.240.0040.01415.31
7.1.230.0140.00315.40
7.1.220.0080.00815.23
7.1.210.0090.00615.30
7.1.200.0070.00515.49
7.1.190.0040.01115.21
7.1.180.0070.01015.20
7.1.170.0120.00315.29
7.1.160.0040.01115.39
7.1.150.0030.01015.43
7.1.140.0110.00415.51
7.1.130.0060.00915.27
7.1.120.0060.01015.51
7.1.110.0110.00415.23
7.1.100.0080.00716.74
7.1.90.0070.01015.59
7.1.80.0090.00615.33
7.1.70.0060.00916.12
7.1.60.0090.01117.41
7.1.50.0140.01024.88
7.1.40.0110.00415.48
7.1.30.0030.01215.20
7.1.20.0110.00415.47
7.1.10.0090.00615.44
7.1.00.0040.03918.90
7.0.330.0130.00515.06
7.0.320.0090.00915.11
7.0.310.0000.01415.23
7.0.300.0100.00715.28
7.0.290.0050.00815.28
7.0.280.0060.00915.30
7.0.270.0060.00915.33
7.0.260.0070.01015.28
7.0.250.0040.01115.15
7.0.240.0060.01015.25
7.0.230.0140.01015.45
7.0.220.0090.00615.14
7.0.210.0100.00715.22
7.0.200.0050.00816.13
7.0.190.0040.01115.30
7.0.180.0090.00615.26
7.0.170.0110.00415.27
7.0.160.0080.00815.18
7.0.150.0000.01415.40
7.0.140.0100.03518.66
7.0.130.0100.00615.07
7.0.120.0080.00815.25
7.0.110.0100.00715.09
7.0.100.0130.00515.14
7.0.90.0120.00315.08
7.0.80.0080.00815.09
7.0.70.0100.00515.21
7.0.60.0060.02817.57
7.0.50.0050.04416.43
7.0.40.0090.02317.63
7.0.30.0160.03017.66
7.0.20.0180.04117.63
7.0.10.0090.04517.63
7.0.00.0050.02717.66
5.6.400.0110.01215.98
5.6.390.0070.01116.04
5.6.380.0060.01315.97
5.6.370.0090.00915.81
5.6.360.0120.00616.09
5.6.350.0100.00716.27
5.6.340.0090.00915.89
5.6.330.0090.00915.86
5.6.320.0060.01215.83
5.6.310.0110.00815.90
5.6.300.0150.00415.77
5.6.290.0140.00415.75
5.6.280.0080.04018.41
5.6.270.0060.01216.07
5.6.260.0120.00916.09
5.6.250.0030.01515.74
5.6.240.0100.00715.94
5.6.230.0070.01115.83
5.6.220.0080.00815.97
5.6.210.0100.04318.37
5.6.200.0110.03616.92
5.6.190.0080.04618.11
5.6.180.0220.04018.21
5.6.170.0170.04518.25
5.6.160.0130.01918.27
5.6.150.0100.02217.04
5.6.140.0080.03816.95
5.6.130.0090.02517.01
5.6.120.0050.02818.44
5.6.110.0090.02418.56
5.6.100.0090.04518.44
5.6.90.0070.02318.38
5.6.80.0070.04618.21
5.6.70.0160.00415.93
5.6.60.0080.01715.82
5.6.50.0180.00315.84
5.6.40.0180.00616.10
5.6.30.0070.01316.00
5.6.20.0220.00615.90
5.6.10.0120.01515.80
5.6.00.0170.01016.07
5.5.380.0030.01515.62
5.5.370.0140.00515.98
5.5.360.0140.00615.94
5.5.350.0150.02018.07
5.5.340.0080.03016.88
5.5.330.0090.04618.03
5.5.320.0060.03518.19
5.5.310.0230.04218.04
5.5.300.0070.03816.94
5.5.290.0120.01816.97
5.5.280.0050.05118.21
5.5.270.0070.03218.35
5.5.260.0160.03618.27
5.5.250.0110.04318.19
5.5.240.0050.04217.91
5.5.230.0080.01115.90
5.5.220.0100.01315.85
5.5.210.0090.01215.70
5.5.200.0100.01315.70
5.5.190.0140.01016.03
5.5.180.0040.01616.00
5.5.170.0030.01615.79
5.5.160.0140.01115.77
5.5.150.0070.01615.83
5.5.140.0150.00715.92
5.5.130.0070.01715.92
5.5.120.0140.00715.90
5.5.110.0130.01015.71
5.5.100.0180.00315.66
5.5.90.0090.01015.66
5.5.80.0200.00015.89
5.5.70.0100.01015.58
5.5.60.0110.01115.84
5.5.50.0100.01415.78
5.5.40.0080.01215.73
5.5.30.0100.01015.89
5.5.20.0100.01015.76
5.5.10.0060.01416.01
5.5.00.0090.00915.46
5.4.450.0310.03116.11
5.4.440.0530.03416.14
5.4.430.0600.03516.11
5.4.420.0480.03316.09
5.4.410.0470.02816.10
5.4.400.0550.03515.98
5.4.390.0600.03915.86
5.4.380.0170.04015.71
5.4.370.0100.03415.67
5.4.360.0160.02715.73
5.4.350.0190.02815.79
5.4.340.0190.02515.66
5.4.330.0170.00012.63
5.4.320.0180.02815.54
5.4.310.0140.03015.61
5.4.300.0180.02515.70
5.4.290.0120.03315.62
5.4.280.0160.02715.71
5.4.270.0080.03515.62
5.4.260.0110.03215.79
5.4.250.0160.02915.57
5.4.240.0110.03415.73
5.4.230.0070.03415.76
5.4.220.0100.03415.74
5.4.210.0110.03115.79
5.4.200.0130.03414.70
5.4.190.0130.02915.65
5.4.180.0130.03015.72
5.4.170.0130.03215.66
5.4.160.0130.03115.64
5.4.150.0170.04115.69
5.4.140.0130.02814.54
5.4.130.0140.02614.56
5.4.120.0090.03114.46
5.4.110.0180.02514.47
5.4.100.0150.02714.38
5.4.90.0120.03014.52
5.4.80.0130.02814.44
5.4.70.0080.03514.30
5.4.60.0050.03714.53
5.4.50.0080.03114.48
5.4.40.0110.04114.44
5.4.30.0140.03914.48
5.4.20.0100.03214.46
5.4.10.0100.03214.54
5.4.00.0100.04214.20
5.3.290.0140.03514.05
5.3.280.0150.02813.93
5.3.270.0170.02814.05
5.3.260.0190.02913.88
5.3.250.0120.03714.00
5.3.240.0150.03513.95
5.3.230.0210.04413.96
5.3.220.0170.04013.87
5.3.210.0120.03513.97
5.3.200.0120.03013.91
5.3.190.0110.03113.94
5.3.180.0100.03313.90
5.3.170.0240.02914.06
5.3.160.0180.02313.97
5.3.150.0100.03313.91
5.3.140.0130.02814.04
5.3.130.0150.02814.01
5.3.120.0170.02713.99
5.3.110.0130.03113.95
5.3.100.0130.03213.71
5.3.90.0090.03313.66
5.3.80.0090.03413.71
5.3.70.0140.03013.66
5.3.60.0110.02913.57
5.3.50.0140.02613.54
5.3.40.0120.03013.58
5.3.30.0110.02913.54
5.3.20.0070.03613.43
5.3.10.0130.03013.39
5.3.00.0120.02813.32
5.2.170.0150.02011.63
5.2.160.0090.02411.66
5.2.150.0140.02311.74
5.2.140.0080.02611.59
5.2.130.0110.02511.63
5.2.120.0130.02211.59
5.2.110.0100.02711.60
5.2.100.0080.02711.63
5.2.90.0090.02411.61
5.2.80.0050.03011.71
5.2.70.0110.02311.58
5.2.60.0110.02311.50
5.2.50.0110.02211.60
5.2.40.0090.02311.58
5.2.30.0050.03211.60
5.2.20.0110.02011.50
5.2.10.0110.02011.39
5.2.00.0120.02111.25
5.1.60.0100.02210.52
5.1.50.0080.02010.66
5.1.40.0070.02010.67
5.1.30.0150.01910.89
5.1.20.0070.02410.97
5.1.10.0140.01710.69
5.1.00.0050.02410.76
5.0.50.0090.0149.50
5.0.40.0130.0089.48
5.0.30.0050.0259.32
5.0.20.0050.0189.37
5.0.10.0040.0189.33
5.0.00.0070.0229.31
4.4.90.0020.0138.11
4.4.80.0050.0118.11
4.4.70.0030.0148.11
4.4.60.0060.0108.16
4.4.50.0050.0118.15
4.4.40.0030.0218.10
4.4.30.0080.0088.17
4.4.20.0030.0138.14
4.4.10.0060.0108.14
4.4.00.0020.0218.14
4.3.110.0030.0138.14
4.3.100.0070.0118.07
4.3.90.0030.0138.07
4.3.80.0060.0178.07
4.3.70.0030.0138.07
4.3.60.0060.0108.07
4.3.50.0010.0158.09
4.3.40.0110.0128.11
4.3.30.0050.0107.47
4.3.20.0020.0147.43
4.3.10.0020.0167.42
4.3.00.0050.0129.90

preferences:
49.05 ms | 401 KiB | 5 Q