3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fruits = [ ['name_id' => 'apple2', 'color' => 'green', 'taste' => 'sweet', 'quantity' => '2', 'price' => 'priceless'], ['name_id' => 'apple1', 'color' => 'red', 'taste' => 'sweet', 'quantity' => '3', 'price' => 'cheap'], ['name_id' => 'apple3', 'color' => 'red', 'taste' => 'sweet', 'quantity' => '1', 'price' => '2'], ['name_id' => 'apple4', 'color' => 'blue', 'taste' => 'another', 'quantity' => '2', 'price' => '1'], ['name_id' => 'apple5', 'color' => 'red', 'taste' => 'bitter', 'quantity' => '1', 'price' => '100'], ['name_id' => 'apple6', 'color' => 'red', 'taste' => 'indefinable', 'quantity' => '6', 'price' => '100'], ['name_id' => 'apple7', 'color' => 'red', 'taste' => 'indefinable', 'quantity' => '2', 'price' => '10'], ['name_id' => 'apple8', 'color' => 'green', 'taste' => 'sour', 'quantity' => '2', 'price' => 'priceless'], ['name_id' => 'apple9', 'color' => 'green', 'taste' => 'sour', 'quantity' => '1', 'price' => 'cheap'] ]; $param1 = 'color'; $param2 = 'taste'; $result = []; foreach ($fruits as $fruit) { $defaults[$fruit[$param2]] = ''; $result[$fruit[$param1]][$fruit[$param2]] = ($result[$fruit[$param1]][$fruit[$param2]] ?? 0) + $fruit['quantity']; } ksort($defaults); ksort($result); echo "<table border=1 cellspacing=0 cellpadding=4>"; echo '<tr><th></th><th>' . implode('</th><th>', array_keys($defaults)) . "</th></tr>\n"; foreach ($result as $p1 => $row) { $row = array_replace(['label' => $p1] + $defaults, $row); echo '<tr><td>' . implode('</td><td>', $row) . "</td></tr>\n"; } echo "</table>";

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.5.00.0090.01220.02
8.4.150.0030.00014.05
8.4.140.0180.00717.81
8.4.130.0090.00317.65
8.4.120.0140.00619.11
8.4.110.0100.01119.09
8.4.100.0120.01117.94
8.4.90.0120.00920.47
8.4.80.0040.00419.14
8.4.70.0150.00620.42
8.4.60.0110.01018.82
8.4.50.0130.00718.57
8.4.40.0070.01417.63
8.4.30.0060.01020.64
8.4.20.0070.01019.68
8.4.10.0130.00319.18
8.3.280.0140.00618.36
8.3.270.0150.00516.72
8.3.260.0140.00516.52
8.3.250.0100.00718.92
8.3.240.0110.00816.46
8.3.230.0080.01116.66
8.3.220.0080.00719.12
8.3.210.0040.00416.85
8.3.200.0050.00416.70
8.3.190.0050.00517.36
8.3.180.0100.00518.75
8.3.170.0110.00419.04
8.3.160.0060.01216.61
8.3.150.0090.00917.14
8.3.140.0050.00318.82
8.3.130.0060.00316.59
8.3.120.0000.00819.11
8.3.110.0070.00420.94
8.3.100.0040.00424.06
8.3.90.0040.00426.77
8.3.80.0090.00016.50
8.3.70.0090.00616.88
8.3.60.0090.01218.56
8.3.50.0100.00317.98
8.3.40.0070.00722.04
8.3.30.0040.01218.79
8.3.20.0050.00324.18
8.3.10.0070.00024.66
8.3.00.0000.00826.16
8.2.290.0090.01117.48
8.2.280.0090.00519.99
8.2.270.0080.01216.88
8.2.260.0110.00717.39
8.2.250.0120.00318.25
8.2.240.0190.00018.83
8.2.230.0130.00322.58
8.2.220.0040.01137.54
8.2.210.0000.00826.77
8.2.200.0040.00816.50
8.2.190.0100.01016.63
8.2.180.0090.00925.92
8.2.170.0110.00418.84
8.2.160.0110.00422.96
8.2.150.0080.00025.66
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0040.00419.65
8.2.110.0030.00620.99
8.2.100.0040.00718.03
8.2.90.0050.00317.88
8.2.80.0000.00818.95
8.2.70.0040.00417.75
8.2.60.0000.00818.04
8.2.50.0040.00418.07
8.2.40.0060.00318.22
8.2.30.0040.00418.04
8.2.20.0000.00818.23
8.2.10.0040.00419.22
8.2.00.0080.00019.41
8.1.330.0140.00716.35
8.1.320.0100.00917.90
8.1.310.0110.00316.74
8.1.300.0040.01418.00
8.1.290.0040.00418.88
8.1.280.0070.01125.92
8.1.270.0040.00423.99
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0090.00023.86
8.1.230.0120.00017.70
8.1.220.0030.00617.74
8.1.210.0040.00418.77
8.1.200.0040.00417.35
8.1.190.0000.00817.36
8.1.180.0050.00318.10
8.1.170.0080.00020.24
8.1.160.0040.00418.83
8.1.150.0040.00418.67
8.1.140.0070.00020.71
8.1.130.0070.00018.95
8.1.120.0070.00017.40
8.1.110.0040.00417.48
8.1.100.0070.00017.56
8.1.90.0040.00417.34
8.1.80.0000.00817.44
8.1.70.0070.00017.39
8.1.60.0040.00417.57
8.1.50.0040.00417.48
8.1.40.0090.00017.57
8.1.30.0040.00417.57
8.1.20.0050.00317.68
8.1.10.0040.00717.60
8.1.00.0060.00317.55
8.0.300.0000.00718.87
8.0.290.0030.00616.75
8.0.280.0000.00718.35
8.0.270.0040.00418.09
8.0.260.0000.00618.51
8.0.250.0040.00416.95
8.0.240.0030.00316.92
8.0.230.0040.00417.07
8.0.220.0030.00317.02
8.0.210.0030.00316.95
8.0.200.0030.00316.91
8.0.190.0000.00817.06
8.0.180.0030.00317.05
8.0.170.0050.00316.94
8.0.160.0000.00716.86
8.0.150.0040.00816.93
8.0.140.0070.00016.83
8.0.130.0030.00313.44
8.0.120.0000.00817.00
8.0.110.0050.00216.87
8.0.100.0000.00716.97
8.0.90.0050.00316.87
8.0.80.0080.00016.97
8.0.70.0000.00717.02
8.0.60.0040.00416.92
8.0.50.0050.00316.87
8.0.30.0000.00717.03
8.0.20.0040.00417.00
8.0.10.0040.00416.98
8.0.00.0020.00517.02
7.4.330.0050.00015.55
7.4.320.0030.00316.50
7.4.300.0000.00716.65
7.4.290.0040.00416.45
7.4.280.0080.00016.67
7.4.270.0040.00416.66
7.4.260.0050.00013.32
7.4.250.0040.00416.62
7.4.240.0000.00716.55
7.4.230.0050.00216.59
7.4.220.0000.00716.43
7.4.210.0000.00816.46
7.4.200.0050.00316.66
7.4.190.0030.00616.72
7.4.180.0030.00316.60
7.4.160.0070.00016.63
7.4.150.0000.00816.31
7.4.140.0040.00416.57
7.4.130.0050.00316.41
7.4.120.0040.00416.39
7.4.110.0030.00516.55
7.4.100.0000.00816.59
7.4.90.0080.00016.67
7.4.80.0030.00316.49
7.4.70.0030.00316.66
7.4.60.0040.00416.38
7.4.50.0000.00816.44
7.4.40.0070.00016.61
7.4.30.0030.00616.57
7.4.20.0000.00716.58
7.4.10.0050.00216.58
7.4.00.0000.00716.48
7.3.330.0030.00616.38
7.3.320.0050.00013.32
7.3.310.0000.00716.18
7.3.300.0030.00316.33
7.3.290.0070.00016.36
7.3.280.0070.00016.36
7.3.270.0040.00416.24
7.3.260.0050.00316.36
7.3.250.0000.00716.31
7.3.240.0050.00216.37
7.3.230.0030.00316.38
7.3.220.0030.00316.14
7.3.210.0030.00316.22
7.3.200.0070.00016.11
7.3.190.0030.00316.33
7.3.180.0030.00316.24
7.3.170.0030.00316.18
7.3.160.0000.00716.36
7.3.150.0030.00316.13
7.3.140.0040.00416.30
7.3.130.0030.00316.38
7.3.120.0030.00516.29
7.3.110.0040.00416.19
7.3.100.0000.00716.27
7.3.90.0070.00016.37
7.3.80.0000.00716.26
7.3.70.0030.00316.35
7.3.60.0070.00016.40
7.3.50.0000.00716.38
7.3.40.0040.00416.48
7.3.30.0030.00316.47
7.3.20.0050.00216.52
7.3.10.0070.00016.37
7.3.00.0030.00316.25
5.6.120.0060.00715.62

preferences:
25.4 ms | 403 KiB | 5 Q