3v4l.org

run code in 300+ PHP versions simultaneously
<?php $properties_no = ['1021-5150', '1021-5152', '1021-5153', '1021-5154', '1021-5156', '1021-5157', '1021-5158', '1021-5159', '1021-5161', '1021-5162', '1021-5163']; final class Range { private string $from; private string $to; public function __construct(string $from, string $to) { $this->from = $from; $this->to = $to; } public function __toString(): string { return $this->from === $this->to ? $this->from : "{$this->from} to {$this->to}"; } } /** * @param string[] $values * @return Range[] */ function computeRanges(array $values): array { if (count($values) === 0) { return []; } $ranges = []; $first = $previous = $values[0]; $previousIntValue = (int)str_replace('-', '', $first); foreach (array_slice($values, 1) as $value) { $intValue = (int)str_replace('-', '', $value); if ($intValue > $previousIntValue + 1) { $ranges[] = new Range($first, $previous); $first = $value; } $previous = $value; $previousIntValue = $intValue; } $ranges[] = new Range($first, $previous); return $ranges; } echo implode(PHP_EOL, computeRanges($properties_no));

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.30.0120.00617.59
8.5.20.0090.00919.88
8.5.10.0110.00716.84
8.5.00.0130.00819.83
8.4.180.0130.00919.49
8.4.170.0100.01324.02
8.4.160.0080.00223.88
8.4.150.0070.00616.87
8.4.140.0090.01217.61
8.4.130.0100.01017.75
8.4.120.0130.00724.29
8.4.110.0140.00718.89
8.4.100.0110.00917.68
8.4.90.0130.00917.57
8.4.80.0140.00619.59
8.4.70.0130.00719.57
8.4.60.0090.01318.65
8.4.50.0120.00718.91
8.4.40.0030.00617.86
8.4.30.0060.01220.16
8.4.20.0030.01725.68
8.4.10.0160.00321.44
8.3.300.0110.00922.73
8.3.290.0060.00418.57
8.3.280.0060.00517.08
8.3.270.0110.00916.75
8.3.260.0090.01016.66
8.3.250.0090.01019.20
8.3.240.0060.00216.75
8.3.230.0150.00516.82
8.3.220.0110.00616.59
8.3.210.0040.00416.76
8.3.200.0060.00316.55
8.3.190.0120.00716.98
8.3.180.0150.00519.03
8.3.170.0110.00717.09
8.3.160.0150.00417.11
8.3.150.0100.01017.12
8.3.140.0040.00416.68
8.3.130.0080.00818.48
8.3.120.0060.00318.86
8.3.110.0040.00420.94
8.3.100.0090.00024.06
8.3.90.0030.01026.77
8.3.80.0060.00319.36
8.3.70.0120.00616.63
8.3.60.0140.00718.45
8.3.50.0130.00524.47
8.3.40.0090.00918.75
8.3.30.0120.00318.71
8.3.20.0030.00524.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.300.0130.00818.14
8.2.290.0100.00818.96
8.2.280.0070.00820.00
8.2.270.0040.01416.79
8.2.260.0060.00316.39
8.2.250.0090.00918.38
8.2.240.0000.00817.00
8.2.230.0060.00322.58
8.2.220.0040.01137.54
8.2.210.0130.00626.77
8.2.200.0120.00016.62
8.2.190.0070.00716.58
8.2.180.0070.00725.92
8.2.170.0110.00419.08
8.2.160.0070.00722.96
8.2.150.0000.00725.66
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0050.00326.35
8.2.110.0100.00022.30
8.2.100.0040.00819.51
8.2.90.0000.00917.61
8.2.80.0050.00318.87
8.2.70.0000.00818.04
8.2.60.0040.00418.22
8.2.50.0030.00618.10
8.2.40.0040.00419.41
8.2.30.0030.00519.36
8.2.20.0040.00418.18
8.2.10.0050.00219.38
8.2.00.0020.00519.25
8.1.340.0140.00817.72
8.1.330.0100.00916.17
8.1.320.0100.00918.05
8.1.310.0000.00817.93
8.1.300.0090.00618.30
8.1.290.0090.00018.88
8.1.280.0140.00725.92
8.1.270.0080.00023.99
8.1.260.0020.00528.09
8.1.250.0040.00428.09
8.1.240.0040.00422.19
8.1.230.0090.00317.95
8.1.220.0040.00417.79
8.1.210.0030.00518.77
8.1.200.0060.00317.36
8.1.190.0050.00317.23
8.1.180.0000.00818.10
8.1.170.0030.00618.65
8.1.160.0000.00919.04
8.1.150.0050.00318.80
8.1.140.0040.00418.86
8.1.130.0040.00420.15
8.1.120.0040.00417.49
8.1.110.0080.00017.49
8.1.100.0000.00717.39
8.1.90.0000.00717.45
8.1.80.0050.00217.36
8.1.70.0040.00417.43
8.1.60.0040.00417.57
8.1.50.0030.00517.56
8.1.40.0040.00417.50
8.1.30.0050.00217.67
8.1.20.0060.00317.55
8.1.10.0060.00317.54
8.1.00.0040.00417.51
8.0.300.0030.00618.77
8.0.290.0040.00416.75
8.0.280.0030.00318.46
8.0.270.0000.00816.74
8.0.260.0060.00020.15
8.0.250.0000.00716.87
8.0.240.0050.00316.94
8.0.230.0000.00916.96
8.0.220.0000.00716.82
8.0.210.0030.00316.96
8.0.200.0030.00316.95
8.0.190.0000.00716.94
8.0.180.0050.00216.93
8.0.170.0000.00916.92
8.0.160.0040.00416.91
8.0.150.0040.00416.73
8.0.140.0070.00016.75
8.0.130.0050.00013.34
8.0.120.0080.00016.76
8.0.110.0030.00316.71
8.0.100.0000.00816.84
8.0.90.0000.00816.75
8.0.80.0080.01016.90
8.0.70.0040.00416.93
8.0.60.0040.00416.96
8.0.50.0020.00516.76
8.0.30.0070.01017.28
8.0.20.0080.01217.12
8.0.10.0040.00416.96
8.0.00.0030.01916.94
7.4.330.0030.00315.55
7.4.320.0000.00616.50
7.4.300.0060.00016.54
7.4.290.0000.00716.53
7.4.280.0030.00416.44
7.4.270.0070.00016.54
7.4.260.0030.00313.30
7.4.250.0040.00416.41
7.4.240.0030.00316.68
7.4.230.0000.00716.68
7.4.220.0030.00316.50
7.4.210.0080.00916.56
7.4.200.0040.00416.36
7.4.130.0070.01016.51
7.4.120.0090.00916.30
7.4.110.0100.01016.53
7.4.100.0100.00716.64
7.4.90.0070.01316.52
7.4.80.0230.00916.46
7.4.70.0130.01016.27
7.4.60.0220.01316.53
7.4.50.0220.00816.36
7.4.40.0170.01316.51
7.4.30.0250.00516.29
7.4.20.0130.01616.08
7.4.10.0100.01615.98
7.4.00.0100.01216.44
7.3.330.0030.00316.05
7.3.320.0060.00012.98
7.3.310.0030.00316.02
7.3.300.0000.00716.13
7.3.290.0040.01116.13
7.3.280.0040.01116.13
7.3.260.0120.00616.17
7.3.230.0060.01216.38
7.3.210.0060.01016.24
7.3.200.0170.01716.23
7.3.190.0220.01316.25
7.3.180.0450.00316.55
7.3.170.0240.00616.23
7.3.160.0210.00415.83
7.3.150.0200.00516.03
7.3.140.0130.01316.09
7.3.130.0140.01416.01
7.3.120.0160.00916.03
7.3.110.0170.01015.91
7.3.100.0170.01016.23
7.3.90.0210.00316.04
7.3.80.0220.00316.04
7.3.70.0220.00615.92
7.3.60.0190.01816.22
7.3.50.0270.00516.21
7.3.40.0170.00916.11
7.3.30.0250.01116.31
7.3.20.0260.01316.16
7.3.10.0270.01416.11
7.3.00.0260.01316.21
7.2.330.0070.01016.48
7.2.320.0180.00316.31
7.2.310.0250.00616.12
7.2.300.0200.01216.36
7.2.290.0210.00416.32
7.2.280.0180.00715.98
7.2.270.0140.01116.19
7.2.260.0100.01416.06
7.2.250.0210.00515.99
7.2.240.0170.01616.30
7.2.230.0110.01315.98
7.2.220.0180.00916.28
7.2.210.0240.00716.13
7.2.200.0330.01016.38
7.2.190.0250.01116.42
7.2.180.0250.01516.19
7.2.170.0220.00916.32
7.2.160.0360.00416.20
7.2.150.0310.00916.42
7.2.140.0460.00816.54
7.2.130.0330.00616.43
7.2.120.0250.01416.43
7.2.110.0240.01616.32
7.2.100.0220.00516.30
7.2.90.0250.00716.12
7.2.80.0570.01515.96
7.2.70.0270.01216.11
7.2.60.0220.01116.45
7.2.50.0280.00516.40
7.2.40.0110.00816.09
7.2.30.0240.00516.23
7.2.20.0170.01116.21
7.2.10.0120.01716.29
7.2.00.0300.01916.10

preferences:
45.57 ms | 1510 KiB | 5 Q