3v4l.org

run code in 300+ PHP versions simultaneously
<?php $numbers = range(1, 5); // numbers to pick from $length = 4; // amount of items in the set $sets_amount = 100; // amount of sets you want to generate $existing = array(); // where we store existing sets $shuffle_period = count($numbers) - $length - 1; // how often we re-randomize the elements $j = 0; for ($i = 0; $i < $sets_amount; $i++, $j++) { if (!($i % $shuffle_period)) { shuffle($numbers); // randomize at first go and on $shuffle_period $j = 0; } do { $arr = array_slice($numbers, $j, $length); } while (in_array($arr, $existing)); $existing[] = $arr; } print_r($existing); ?>

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)
7.3.00.0080.00816.67
7.2.130.0000.01216.80
7.2.120.0000.01717.01
7.2.110.0000.01016.83
7.2.100.0080.00316.86
7.2.90.0040.00417.07
7.2.80.0060.01016.75
7.2.70.0070.00716.85
7.2.60.0000.01217.06
7.2.50.0060.00616.75
7.2.40.0000.01317.05
7.2.30.0040.01117.04
7.2.20.0030.01017.01
7.2.10.0100.00317.01
7.2.00.0140.01018.23
7.1.250.0080.00415.42
7.1.240.0030.00715.65
7.1.230.0040.00716.02
7.1.220.0000.01315.90
7.1.210.0060.00615.89
7.1.200.0060.00615.54
7.1.190.0080.00415.60
7.1.180.0080.00415.73
7.1.170.0000.00715.79
7.1.160.0060.00315.86
7.1.150.0000.01115.87
7.1.140.0060.00815.98
7.1.130.0080.00315.85
7.1.120.0080.00415.58
7.1.110.0030.00916.01
7.1.100.0030.01215.81
7.1.90.0000.01115.79
7.1.80.0130.00015.97
7.1.70.0040.00716.61
7.1.60.0090.00817.79
7.1.50.0030.01216.45
7.1.40.0070.00715.92
7.1.30.0030.00615.61
7.1.20.0080.00315.91
7.1.10.0030.00615.72
7.1.00.0060.01719.26
7.0.330.0060.00615.43
7.0.320.0030.01215.64
7.0.310.0090.00615.21
7.0.300.0030.00715.21
7.0.290.0030.00615.47
7.0.280.0030.00315.34
7.0.270.0060.00915.45
7.0.260.0030.00615.26
7.0.250.0000.01415.26
7.0.240.0000.00915.48
7.0.230.0070.00715.13
7.0.220.0000.01415.54
7.0.210.0070.00715.46
7.0.200.0030.00615.97
7.0.190.0000.00815.43
7.0.180.0040.01115.46
7.0.170.0080.00015.40
7.0.160.0070.00715.46
7.0.150.0000.00715.38
7.0.140.0000.04318.73
7.0.130.0090.00015.43
7.0.120.0030.00615.27
7.0.110.0030.00615.32
7.0.100.0040.00815.27
7.0.90.0030.00615.06
7.0.80.0030.00615.48
7.0.70.0000.00915.15
7.0.60.0040.02417.69
7.0.50.0040.02216.52
7.0.40.0050.04716.93
7.0.30.0150.04216.71
7.0.20.0130.03216.84
7.0.10.0180.04316.75
7.0.00.0050.03016.79
5.6.380.0072.49014.77
5.6.370.0002.49614.40
5.6.360.0032.49514.62
5.6.350.0102.48714.40
5.6.340.0032.48714.64
5.6.330.0002.49614.14
5.6.320.0002.49614.72
5.6.310.0102.48814.63
5.6.300.0102.48514.53
5.6.290.0102.48014.51
5.6.280.0002.49917.80
5.6.270.0072.48814.39
5.6.260.0072.49114.45
5.6.250.0032.49514.46
5.6.240.0072.48414.50
5.6.230.0032.49314.29
5.6.220.0032.49314.30
5.6.210.0052.49417.53
5.6.200.0052.49216.14
5.6.190.0122.43317.30
5.6.180.1902.30817.33
5.6.170.0202.47917.46
5.6.160.0082.49017.31
5.6.150.0102.48916.22
5.6.140.0082.47916.21
5.6.130.0052.49316.28
5.6.120.0052.49417.60
5.6.110.0072.49117.74
5.6.100.0032.49617.65
5.6.90.0052.49317.50
5.6.80.0082.48617.29
5.6.70.0172.48117.32
5.6.60.0032.49514.34
5.6.50.0102.48514.46
5.6.40.0032.49214.11
5.6.30.0002.49214.08
5.6.20.0002.49814.06
5.6.10.0032.49514.28
5.6.00.0072.49014.27
5.5.380.0032.47111.23
5.5.370.0032.49211.11
5.5.360.0002.49811.21
5.5.350.0102.48215.87
5.5.340.0182.45515.98
5.5.330.0132.46416.08
5.5.320.0102.44716.12
5.5.310.0052.47616.02
5.5.300.0132.47516.09
5.5.290.0072.49014.54
5.5.280.0072.49215.93
5.5.270.0152.44715.94
5.5.260.0132.46415.92
5.5.250.0032.49515.78
5.5.240.0082.48215.62
5.5.230.0002.49710.88
5.5.220.0032.48710.67
5.5.210.0002.49711.08
5.5.200.0072.37310.98
5.5.190.0072.48610.71
5.5.180.0032.49511.08
5.5.170.0072.49111.14
5.5.160.0032.49110.99
5.5.150.0032.49210.86
5.5.140.0032.49411.11
5.5.130.0072.48511.18
5.5.120.0072.49111.30
5.5.110.0032.49411.18
5.5.100.0032.49511.32
5.5.90.0002.49810.88
5.5.80.0002.49811.07
5.5.70.0002.49810.67
5.5.60.0032.49311.13
5.5.50.0032.49411.10
5.5.40.0102.48410.83
5.5.30.0032.49510.87
5.5.20.0032.49310.83
5.5.10.0032.49410.90
5.5.00.0072.48310.93
5.4.450.0472.44515.14
5.4.440.0052.44615.22
5.4.430.0082.47715.20
5.4.420.0102.46415.20
5.4.410.0372.45315.20
5.4.400.0222.41214.91
5.4.390.0182.45614.84
5.4.380.0082.45715.00
5.4.370.0202.35414.85
5.4.360.0132.13414.98
5.4.350.0102.21615.10
5.4.340.0102.33315.06
5.4.330.0032.49511.11
5.4.320.0032.11115.03
5.4.310.0052.23411.75
5.4.300.0122.05515.03
5.4.290.0202.19214.96
5.4.280.0091.99011.70
5.4.270.0102.46714.92
5.4.260.0132.23714.96
5.4.250.0102.31515.02
5.4.240.0152.37915.06
5.4.230.0082.46914.89
5.4.220.0041.99611.65
5.4.210.0122.47915.02
5.4.200.0122.46915.03
5.4.190.0122.46515.02
5.4.180.0082.46714.99
5.4.170.0152.39915.07
5.4.160.0102.34914.97
5.4.150.0071.98811.60
5.4.140.0071.99111.56
5.4.130.0152.30713.76
5.4.120.0071.98811.38
5.4.110.0102.29913.71
5.4.100.0221.97211.38
5.4.90.0101.91711.48
5.4.80.0071.75711.49
5.4.70.0072.46813.63
5.4.60.0152.40113.64
5.4.50.0102.44513.67
5.4.40.0172.20813.66
5.4.30.0032.14613.61
5.4.20.0101.98413.57
5.4.10.0191.82211.47
5.4.00.0221.97411.09
5.3.290.0072.27912.36
5.3.280.0191.95611.49
5.3.270.0201.97811.54
5.3.260.0241.97311.56
5.3.250.0072.18712.36
5.3.240.0051.99111.46
5.3.230.0132.20412.37
5.3.220.0071.99211.49
5.3.210.0122.26212.27
5.3.200.0071.99111.53
5.3.190.0151.98011.54
5.3.180.0102.29612.40
5.3.170.0082.43412.44
5.3.160.0071.99011.64
5.3.150.0171.97611.60
5.3.140.0122.32912.37
5.3.130.0091.98611.54
5.3.120.0182.12812.31
5.3.110.0061.99111.55
5.3.100.0091.98811.27
5.3.90.0071.99111.21
5.3.80.0231.91211.96
5.3.70.0251.97311.17
5.3.60.0051.99311.20
5.3.50.0221.93612.01
5.3.40.0072.13211.90
5.3.30.0081.99011.03
5.3.20.0082.37511.85
5.3.10.0102.01711.65
5.3.00.0072.48811.71
5.2.170.0051.88110.44
5.2.160.0122.04210.45
5.2.150.0051.9899.54
5.2.140.0102.18510.46
5.2.130.0172.38310.40
5.2.120.0072.18510.49
5.2.110.0052.24510.44
5.2.100.0022.47810.44
5.2.90.0071.9869.52
5.2.80.0072.47510.43
5.2.70.0122.45710.38
5.2.60.0152.46810.42
5.2.50.0032.48010.40
5.2.40.0102.48210.37
5.2.30.0122.46310.37
5.2.20.0041.9749.45
5.2.10.0041.9939.41
5.2.00.0072.17510.21
5.1.60.0052.2869.85
5.1.50.0122.2509.88
5.1.40.0082.4629.90
5.1.30.0052.49010.07
5.1.20.0122.45510.08
5.1.10.0172.4469.93
5.1.00.0102.4759.93
5.0.50.0022.4679.14
5.0.40.0152.4189.10
5.0.30.0072.4549.09
5.0.20.0102.4519.09
5.0.10.0152.4359.09
5.0.00.0132.3149.09
4.4.90.0041.9937.38
4.4.80.0032.4789.10
4.4.70.0052.4119.10
4.4.60.0022.2879.10
4.4.50.0041.9947.37
4.4.40.0002.1929.10
4.4.30.0082.3429.10
4.4.20.0072.4699.09
4.4.10.0082.4349.09
4.4.00.0032.4649.09
4.3.110.0052.4779.09
4.3.100.0152.4439.09
4.3.90.0072.4599.09
4.3.80.0032.2579.09
4.3.70.0072.2169.09
4.3.60.0182.2859.09
4.3.50.0052.2579.09
4.3.40.0122.2439.09
4.3.30.0032.3129.09
4.3.20.0022.4619.09
4.3.10.0152.4459.09
4.3.00.0072.4719.09

preferences:
39.75 ms | 401 KiB | 5 Q