3v4l.org

run code in 300+ PHP versions simultaneously
<?php $numbers = range(1, 2,3); // numbers to pick from $length = 2; // 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.4.10.0130.00614.96
7.4.00.0090.00914.76
7.3.130.0100.01014.95
7.3.120.0030.01714.81
7.3.110.0100.00714.91
7.3.100.0060.01014.96
7.3.90.0170.00414.69
7.3.80.0070.01014.84
7.3.70.0060.00614.92
7.3.60.0070.01114.81
7.3.50.0050.00514.88
7.3.40.0070.00714.67
7.3.30.0000.01214.77
7.3.20.0000.01216.67
7.3.10.0000.01116.55
7.3.00.0070.01016.56
7.2.260.0100.01015.25
7.2.250.0070.01114.88
7.2.240.0070.01114.59
7.2.230.0060.00915.11
7.2.220.0070.00715.13
7.2.210.0060.00814.89
7.2.200.0070.00715.09
7.2.190.0080.00615.12
7.2.180.0000.00815.05
7.2.170.0030.01715.05
7.2.160.0040.00715.13
7.2.150.0070.01016.88
7.2.140.0030.00617.00
7.2.130.0090.00616.62
7.2.120.0070.00716.97
7.2.110.0080.00016.97
7.2.100.0080.00816.74
7.2.90.0000.01916.57
7.2.80.0000.01616.91
7.2.70.0110.00817.06
7.2.60.0060.00616.86
7.2.50.0120.00316.86
7.2.40.0080.00416.84
7.2.30.0140.00316.83
7.2.20.0050.00516.61
7.2.10.0140.00616.93
7.2.00.0090.00518.20
7.1.330.0080.00315.78
7.1.320.0030.00615.76
7.1.310.0000.01315.87
7.1.300.0110.00415.77
7.1.290.0080.00015.77
7.1.280.0070.00715.83
7.1.270.0040.00715.58
7.1.260.0000.01315.60
7.1.250.0070.00415.76
7.1.240.0030.01415.92
7.1.230.0100.00615.96
7.1.220.0030.01415.86
7.1.210.0030.00915.89
7.1.200.0140.00015.89
7.1.190.0060.00315.75
7.1.180.0030.00715.66
7.1.170.0000.01415.66
7.1.160.0040.00415.52
7.1.150.0000.01115.51
7.1.140.0030.01315.79
7.1.130.0110.00415.88
7.1.120.0060.00615.88
7.1.110.0030.00515.95
7.1.100.0040.01215.96
7.1.90.0030.01015.79
7.1.80.0110.00615.76
7.1.70.0070.00416.51
7.1.60.0070.01017.71
7.1.50.0020.01016.59
7.1.40.0030.01215.70
7.1.30.0000.01015.53
7.1.20.0070.01015.68
7.1.10.0060.00915.76
7.1.00.0020.04019.08
7.0.330.0070.00315.22
7.0.320.0070.01015.57
7.0.310.0000.01215.25
7.0.300.0000.01015.49
7.0.290.0000.00915.21
7.0.280.0040.00415.39
7.0.270.0070.00315.68
7.0.260.0050.00315.60
7.0.250.0060.00615.43
7.0.240.0130.00315.60
7.0.230.0040.00815.25
7.0.220.0040.00415.60
7.0.210.0040.00815.43
7.0.200.0040.00916.15
7.0.190.0030.00915.50
7.0.180.0030.00715.61
7.0.170.0090.00615.36
7.0.160.0090.00015.57
7.0.150.0030.00715.71
7.0.140.0010.03918.79
7.0.130.0120.00915.55
7.0.120.0090.00915.50
7.0.110.0070.00715.22
7.0.100.0060.00615.61
7.0.90.0080.00415.31
7.0.80.0080.00415.31
7.0.70.0000.00915.63
7.0.60.0030.02417.63
7.0.50.0040.02916.60
7.0.40.0050.04616.83
7.0.30.0200.04216.61
7.0.20.0150.04416.63
7.0.10.0080.05116.62
7.0.00.0000.03016.72
5.6.400.0040.01214.63
5.6.390.0030.00914.79
5.6.380.0000.01414.67
5.6.370.0080.00614.59
5.6.360.0040.01114.27
5.6.350.0080.00814.70
5.6.340.0000.01014.41
5.6.330.0030.01514.57
5.6.320.0040.01414.49
5.6.310.0110.00714.09
5.6.300.0060.00614.63
5.6.290.0060.00314.41
5.6.280.0100.04417.80
5.6.270.0030.00714.42
5.6.260.0090.00414.13
5.6.250.0000.01414.85
5.6.240.0070.01014.48
5.6.230.0040.00714.29
5.6.220.0080.00814.41
5.6.210.0080.04317.67
5.6.200.0090.04216.28
5.6.190.0050.04017.39
5.6.180.1660.02617.32
5.6.170.0080.03417.31
5.6.160.0100.04317.23
5.6.150.0030.04216.15
5.6.140.0030.02316.26
5.6.130.0060.03016.27
5.6.120.0080.04317.82
5.6.110.0070.04417.59
5.6.100.0080.03217.68
5.6.90.0080.04717.73
5.6.80.0050.04517.24
5.6.70.0100.02417.49
5.6.60.0060.00614.43
5.6.50.0110.00414.74
5.6.40.0070.00714.48
5.6.30.0050.00514.40
5.6.20.0000.00914.36
5.6.10.0060.00914.43
5.6.00.0070.00714.41
5.5.380.0030.00614.27
5.5.370.0070.00714.34
5.5.360.0040.00414.43
5.5.350.0170.04417.52
5.5.340.0060.03417.69
5.5.330.0050.03317.18
5.5.320.0100.02917.70
5.5.310.0060.03417.56
5.5.300.0020.02816.14
5.5.290.0120.03017.73
5.5.280.0070.04517.55
5.5.270.0100.04617.52
5.5.260.0150.03517.61
5.5.250.0060.04817.43
5.5.240.0110.02817.40
5.5.230.0040.00814.37
5.5.220.0050.00514.29
5.5.210.0060.01314.28
5.5.200.0030.00914.42
5.5.190.0040.01114.47
5.5.180.0090.00614.23
5.5.170.0130.00714.53
5.5.160.0000.01814.31
5.5.150.0090.00314.21
5.5.140.0000.01314.55
5.5.130.0060.00614.01
5.5.120.0060.00314.49
5.5.110.0050.00514.57
5.5.100.0150.00414.34
5.5.90.0030.01314.47
5.5.80.0030.00914.21
5.5.70.0100.00714.17
5.5.60.0090.00614.56
5.5.50.0030.01514.39
5.5.40.0040.00714.50
5.5.30.0070.00714.18
5.5.20.0120.00814.43
5.5.10.0030.00714.05
5.5.00.0060.00614.25
5.4.450.0380.03515.30
5.4.440.0350.03515.31
5.4.430.0270.03615.31
5.4.420.0050.03815.27
5.4.410.0420.03415.12
5.4.400.0200.03314.92
5.4.390.0220.03414.89
5.4.380.0070.02915.00
5.4.370.0070.03214.90
5.4.360.0100.02514.98
5.4.350.0120.02814.95
5.4.340.0120.02814.86
5.4.330.0040.00911.22
5.4.320.0060.01911.84
5.4.310.0080.01911.84
5.4.300.0050.02211.85
5.4.290.0090.03015.08
5.4.280.0080.03415.08
5.4.270.0050.02815.09
5.4.260.0050.03215.12
5.4.250.0080.02711.77
5.4.240.0100.03515.02
5.4.230.0100.02715.10
5.4.220.0100.01911.77
5.4.210.0050.03415.10
5.4.200.0160.03315.10
5.4.190.0090.02111.77
5.4.180.0030.03415.06
5.4.170.0080.02511.77
5.4.160.0100.02715.16
5.4.150.0060.02411.77
5.4.140.0070.02511.61
5.4.130.0070.02411.73
5.4.120.0030.03013.77
5.4.110.0100.02513.85
5.4.100.0050.04113.83
5.4.90.0040.02111.58
5.4.80.0090.02513.74
5.4.70.0070.02211.58
5.4.60.0090.01711.58
5.4.50.0070.02713.81
5.4.40.0150.03013.70
5.4.30.0100.03713.67
5.4.20.0040.02911.57
5.4.10.0070.02411.57
5.4.00.0090.02713.46
5.3.290.0060.02112.01
5.3.280.0070.03212.80
5.3.270.0100.03512.75
5.3.260.0130.02612.78
5.3.250.0110.03512.79
5.3.240.0080.02812.76
5.3.230.0030.03312.83
5.3.220.0100.02712.77
5.3.210.0090.01911.95
5.3.200.0040.02211.95
5.3.190.0060.02211.95
5.3.180.0130.02612.76
5.3.170.0050.03312.78
5.3.160.0120.03512.73
5.3.150.0050.02111.95
5.3.140.0150.03412.76
5.3.130.0100.04012.76
5.3.120.0140.03212.78
5.3.110.0160.02912.72
5.3.100.0070.02912.45
5.3.90.0100.02512.49
5.3.80.0170.02212.46
5.3.70.0080.03712.47
5.3.60.0040.02311.64
5.3.50.0080.02011.61
5.3.40.0100.01711.61
5.3.30.0070.03112.37
5.3.20.0090.03412.30
5.3.10.0050.02712.27
5.3.00.0060.03812.24
5.2.170.0000.05310.88
5.2.160.0170.04310.86
5.2.150.0050.0419.10
5.2.140.0070.04710.89
5.2.130.0050.0319.05
5.2.120.0040.0319.05
5.2.110.0030.04710.80
5.2.100.0070.04310.81
5.2.90.0070.0279.05
5.2.80.0050.0339.05
5.2.70.0130.04310.65
5.2.60.0130.03310.72
5.2.50.0030.04310.70
5.2.40.0060.0298.94
5.2.30.0170.04310.72
5.2.20.0070.04310.72
5.2.10.0030.04310.55
5.2.00.0070.04310.45
5.1.60.0100.0509.79
5.1.50.0200.0239.83
5.1.40.0050.0267.98
5.1.30.0100.04010.15
5.1.20.0130.03010.18
5.1.10.0070.0228.08
5.1.00.0170.0339.89
5.0.50.0070.0308.38
5.0.40.0000.0226.43
5.0.30.0070.0438.37
5.0.20.0130.0338.37
5.0.10.0050.0256.19
5.0.00.0030.0478.37
4.4.90.0030.0408.44
4.4.80.0070.0238.44
4.4.70.0030.0338.44
4.4.60.0070.0208.44
4.4.50.0030.0378.44
4.4.40.0130.0408.37
4.4.30.0070.0308.37
4.4.20.0070.0208.37
4.4.10.0030.0308.37
4.4.00.0030.0378.37
4.3.110.0100.0278.37
4.3.100.0000.0278.37
4.3.90.0000.0238.37
4.3.80.0000.0408.23
4.3.70.0070.0208.23
4.3.60.0070.0208.23
4.3.50.0030.0238.23
4.3.40.0100.0408.23
4.3.30.0070.0208.23
4.3.20.0000.0308.23
4.3.10.0070.0208.23
4.3.00.0000.0236.77

preferences:
39.63 ms | 400 KiB | 5 Q