3v4l.org

run code in 300+ PHP versions simultaneously
<?php $total_pages = 100; $current_page = 50; $boundaries = 2; $around = 2; $arr1 = range(1, $boundaries); $arr2 = range($total_pages - max(($boundaries - 1), 0), $total_pages); $arr3 = range(min($current_page - $around, 1), $current_page); $arr4 = range($current_page, $current_page + $around); $result = array_unique(array_merge($arr1, $arr2, $arr3, $arr4)); sort($result); var_dump($result ); ?>

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.60.0040.01318.27
8.3.50.0100.01022.07
8.3.40.0080.00818.77
8.3.30.0040.01119.15
8.3.20.0080.00020.16
8.3.10.0090.00023.60
8.3.00.0040.00420.95
8.2.180.0130.00616.63
8.2.170.0130.00322.96
8.2.160.0100.00720.39
8.2.150.0050.00224.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0000.00919.36
8.2.110.0060.00322.31
8.2.100.0040.00819.28
8.2.90.0040.00419.08
8.2.80.0040.00419.38
8.2.70.0050.00317.47
8.2.60.0030.00617.91
8.2.50.0000.00918.07
8.2.40.0050.00318.22
8.2.30.0040.00417.87
8.2.20.0030.00517.52
8.2.10.0040.00419.80
8.2.00.0020.00518.03
8.1.280.0060.00925.92
8.1.270.0030.00620.37
8.1.260.0040.01126.35
8.1.250.0060.00328.09
8.1.240.0090.00023.70
8.1.230.0030.00719.04
8.1.220.0000.00817.74
8.1.210.0070.00018.77
8.1.200.0060.00317.23
8.1.190.0050.00317.40
8.1.180.0000.00720.10
8.1.170.0060.00318.54
8.1.160.0040.00422.19
8.1.150.0040.00418.86
8.1.140.0000.00717.38
8.1.130.0030.00317.82
8.1.120.0000.00717.43
8.1.110.0060.00317.31
8.1.100.0040.00417.18
8.1.90.0040.00417.40
8.1.80.0000.00817.26
8.1.70.0000.00817.42
8.1.60.0040.00417.44
8.1.50.0050.00317.37
8.1.40.0060.00317.31
8.1.30.0000.00917.42
8.1.20.0030.00617.53
8.1.10.0040.00417.38
8.1.00.0040.00417.37
8.0.300.0000.00718.77
8.0.290.0030.00617.04
8.0.280.0000.00718.43
8.0.270.0030.00517.11
8.0.260.0000.00716.62
8.0.250.0000.00716.91
8.0.240.0030.00316.77
8.0.230.0080.00016.86
8.0.220.0030.00316.82
8.0.210.0000.00816.90
8.0.200.0000.00616.85
8.0.190.0070.00316.86
8.0.180.0000.00716.82
8.0.170.0080.00016.82
8.0.160.0070.00016.74
8.0.150.0050.00216.80
8.0.140.0080.00016.77
8.0.130.0060.00013.24
8.0.120.0030.00516.67
8.0.110.0050.00416.77
8.0.100.0000.00716.81
8.0.90.0050.00316.69
8.0.80.0080.00716.86
8.0.70.0030.00516.82
8.0.60.0040.00416.73
8.0.50.0000.00716.63
8.0.30.0100.01017.00
8.0.20.0120.00817.40
8.0.10.0040.00416.84
8.0.00.0150.00616.68
7.4.330.0030.00315.03
7.4.320.0060.00016.45
7.4.300.0030.00316.43
7.4.290.0030.00316.52
7.4.280.0040.00416.52
7.4.270.0030.00316.42
7.4.260.0040.00416.28
7.4.250.0000.00816.54
7.4.240.0040.00416.46
7.4.230.0030.00516.57
7.4.220.0240.00316.40
7.4.210.0060.00916.40
7.4.200.0070.00016.63
7.4.160.0040.01116.52
7.4.150.0090.00917.40
7.4.140.0110.01017.86
7.4.130.0100.00916.39
7.4.120.0110.00816.48
7.4.110.0080.01116.50
7.4.100.0140.01316.43
7.4.90.0110.00716.21
7.4.80.0190.00719.39
7.4.70.0070.01116.34
7.4.60.0110.00616.34
7.4.50.0060.00316.03
7.4.40.0060.01116.51
7.4.30.0060.01316.23
7.4.00.0070.01115.05
7.3.330.0070.00013.05
7.3.320.0000.00513.08
7.3.310.0000.00816.05
7.3.300.0000.00716.19
7.3.290.0030.00316.18
7.3.280.0060.01016.21
7.3.270.0140.00617.40
7.3.260.0110.00716.41
7.3.250.0090.01116.22
7.3.240.0080.01016.16
7.3.230.0130.01016.39
7.3.210.0090.00916.51
7.3.200.0140.00716.51
7.3.190.0080.01216.35
7.3.180.0170.00016.36
7.3.170.0030.01516.49
7.3.160.0090.00916.52
7.2.330.0120.00616.48
7.2.320.0120.00616.35
7.2.310.0080.01116.62
7.2.300.0110.00716.48
7.2.290.0170.00716.32
7.2.60.0100.00316.80
7.1.200.0040.00715.48
7.1.100.0040.00418.20
7.1.70.0030.00516.94
7.1.60.0060.00617.23
7.1.50.0120.00916.96
7.1.00.0030.07722.42
7.0.200.0090.00916.86
7.0.60.0170.07319.89
7.0.50.0070.08317.88
7.0.40.0030.05020.19
7.0.30.0370.06320.18
7.0.20.0230.04020.13
7.0.10.0000.04720.16
7.0.00.0130.05720.12
5.6.280.0030.07321.07
5.6.210.0130.07720.60
5.6.200.0000.04718.12
5.6.190.0000.04720.41
5.6.180.0030.08320.61
5.6.170.0170.05720.50
5.6.160.0100.08720.47
5.6.150.0170.06718.12
5.6.140.0100.07718.18
5.6.130.0100.07318.06
5.6.120.0130.08021.14
5.6.110.0170.07321.00
5.6.100.0070.06021.00
5.6.90.0000.06321.09
5.6.80.0070.04020.52
5.5.350.0100.04320.49
5.5.340.0030.08317.91
5.5.330.0100.08020.36
5.5.320.0300.04320.17
5.5.310.0170.08320.33
5.5.300.0000.04317.93
5.5.290.0070.08018.01
5.5.280.0070.07320.87
5.5.270.0070.07720.63
5.5.260.0070.09020.76
5.5.250.0070.07020.49
5.5.240.0070.05720.06
5.4.450.0430.05319.55
5.4.440.0770.06019.22
5.4.430.0100.05319.30
5.4.420.0070.06319.33
5.4.410.0100.05719.21
5.4.400.0100.05019.15
5.4.390.0100.05019.06
5.4.380.0130.05018.96
5.4.370.0100.05019.16
5.4.360.0070.05718.98
5.4.350.0170.05018.92
5.4.340.0130.05319.16
5.4.320.0070.05719.05
5.4.310.0170.04719.08
5.4.300.0130.05019.25
5.4.290.0000.06019.05
5.4.280.0200.04319.16
5.4.270.0100.06319.05
5.4.260.0200.06019.13
5.4.250.0030.06018.91
5.4.240.0270.04018.91
5.4.230.0230.04018.91
5.4.220.0070.05718.92
5.4.210.0130.05018.96
5.4.200.0170.04316.63
5.4.190.0070.05319.14
5.4.180.0030.06718.94
5.4.170.0130.05018.94
5.4.160.0070.05318.89
5.4.150.0100.06019.11
5.4.140.0130.04716.51
5.4.130.0030.05316.50
5.4.120.0030.05316.34
5.4.110.0200.03716.52
5.4.100.0070.05316.52
5.4.90.0030.05716.49
5.4.80.0170.04316.13
5.4.70.0070.05316.35
5.4.60.0130.04316.33
5.4.50.0100.04716.39
5.4.40.0030.05716.56
5.4.30.0070.05016.16
5.4.20.0170.04316.20
5.4.10.0030.05316.39
5.4.00.0030.05715.68
5.3.290.0170.04714.60
5.3.280.0170.05014.46
5.3.270.0030.06314.47
5.3.260.0100.05314.65
5.3.250.0100.05014.54
5.3.240.0100.05014.63
5.3.230.0100.05314.51
5.3.220.0130.05014.51
5.3.210.0030.06014.50
5.3.200.0230.04014.56
5.3.190.0100.05014.45
5.3.180.0170.04014.41
5.3.170.0130.04714.52
5.3.160.0100.05014.48
5.3.150.0100.05014.42
5.3.140.0130.04714.59
5.3.130.0200.04314.56
5.3.120.0070.05314.51
5.3.110.0170.04714.59
5.3.100.0030.05713.95
5.3.90.0070.05313.95
5.3.80.0230.04013.98
5.3.70.0100.05013.96
5.3.60.0000.06014.00
5.3.50.0100.04713.82
5.3.40.0230.03313.86
5.3.30.0130.04313.77
5.3.20.0130.04313.59
5.3.10.0100.04713.69
5.3.00.0170.04313.50
5.2.170.0030.04310.95
5.2.160.0170.03311.08
5.2.150.0130.04310.95
5.2.140.0070.05011.00
5.2.130.0100.03711.02
5.2.120.0000.04711.06
5.2.110.0070.04011.03
5.2.100.0130.03310.96
5.2.90.0030.04311.07
5.2.80.0070.04310.96
5.2.70.0100.03711.11
5.2.60.0100.03710.93
5.2.50.0130.03310.93
5.2.40.0100.03310.85
5.2.30.0070.04011.04
5.2.20.0130.03710.98
5.2.10.0130.03310.88
5.2.00.0030.04310.74
5.1.60.0130.03010.10
5.1.50.0000.04310.11
5.1.40.0070.0339.88
5.1.30.0070.03710.40
5.1.20.0100.03710.47
5.1.10.0070.0339.93
5.1.00.0070.03310.23
5.0.50.0030.0308.62
5.0.40.0030.0278.42
5.0.30.0030.0438.23
5.0.20.0130.0178.25
5.0.10.0000.0338.30
5.0.00.0100.0478.11
4.4.90.0070.0175.90
4.4.80.0070.0275.88
4.4.70.0070.0235.81
4.4.60.0100.0175.94
4.4.50.0070.0275.89
4.4.40.0100.0305.88
4.4.30.0070.0205.84
4.4.20.0000.0275.84
4.4.10.0030.0235.98
4.4.00.0070.0305.87
4.3.110.0030.0235.76
4.3.100.0030.0235.76
4.3.90.0000.0235.67
4.3.80.0030.0335.77
4.3.70.0000.0235.68
4.3.60.0030.0205.77
4.3.50.0000.0275.77
4.3.40.0000.0375.64
4.3.30.0070.0234.55
4.3.20.0030.0234.42
4.3.10.0000.0234.37
4.3.00.0170.0177.06

preferences:
27.55 ms | 401 KiB | 5 Q