3v4l.org

run code in 300+ PHP versions simultaneously
<?php $numbers = range(1, 2,3,4,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.4.00.0130.00714.63
7.3.120.0120.00615.00
7.3.110.0080.01114.80
7.3.100.0100.00314.88
7.3.90.0040.00714.52
7.3.80.0080.00415.00
7.3.70.0030.01014.77
7.3.60.0070.01014.83
7.3.50.0040.00414.76
7.3.40.0060.01314.83
7.3.30.0000.01414.63
7.3.20.0140.00316.51
7.3.10.0030.01016.74
7.3.00.0060.00916.29
7.2.250.0040.01614.92
7.2.240.0040.01814.91
7.2.230.0070.01014.89
7.2.220.0040.01514.74
7.2.210.0100.00615.31
7.2.200.0030.00714.96
7.2.190.0100.00614.73
7.2.180.0000.01714.67
7.2.170.0000.01415.01
7.2.00.0070.00519.56
7.1.330.0100.00715.88
7.1.320.0060.01215.39
7.1.310.0080.00615.99
7.1.300.0060.00615.73
7.1.290.0040.00815.74
7.1.280.0030.01315.63
7.1.270.0000.00915.77
7.1.260.0030.01315.74
7.1.70.0030.00317.01
7.1.60.0070.01619.70
7.1.50.0120.00317.21
7.1.00.0070.07322.34
7.0.200.0040.00416.70
7.0.140.0030.07022.08
7.0.90.0000.04719.98
7.0.80.0070.03719.91
7.0.70.0030.04320.15
7.0.60.0070.07719.95
7.0.50.0070.03720.31
7.0.40.0030.04320.11
7.0.30.0030.04320.14
7.0.20.0030.04020.03
7.0.10.0070.04020.04
7.0.00.0030.09020.14
5.6.280.0000.08021.09
5.6.230.0030.03720.69
5.6.220.0100.02720.52
5.6.210.0030.04320.75
5.6.200.0070.04320.94
5.6.190.0070.04021.10
5.6.180.0000.04321.01
5.6.170.0100.03721.03
5.6.160.0030.08021.16
5.6.150.0130.07321.09
5.6.140.0030.05320.93
5.6.130.0070.09021.01
5.6.120.0070.05721.07
5.6.110.0130.04721.07
5.6.100.0100.08021.06
5.6.90.0130.08020.93
5.6.80.0070.04720.38
5.6.70.0100.07720.33
5.6.60.0030.07720.44
5.6.50.0070.08020.48
5.6.40.0030.09020.30
5.6.30.0070.09020.46
5.6.20.0100.08020.45
5.6.10.0070.07320.48
5.6.00.0070.06720.37
5.5.370.0000.04320.39
5.5.360.0000.04020.43
5.5.350.0030.04720.44
5.5.340.0000.04720.77
5.5.330.0030.04020.83
5.5.320.0070.04020.89
5.5.310.0170.03020.82
5.5.300.0070.07320.91
5.5.290.0030.04320.64
5.5.280.0070.04320.76
5.5.270.0100.08720.90
5.5.260.0130.07720.89
5.5.250.0130.03720.64
5.5.240.0030.04720.24
5.5.230.0030.06320.18
5.5.220.0070.05020.24
5.5.210.0130.07720.14
5.5.200.0000.08720.18
5.5.190.0030.09020.25
5.5.180.0130.04020.20
5.5.160.0130.08020.20
5.5.150.0130.07319.97
5.5.140.0070.07720.14
5.5.130.0030.06719.98
5.5.120.0170.03720.12
5.5.110.0100.05020.21
5.5.100.0070.04020.17
5.5.90.0030.06719.93
5.5.80.0030.06020.08
5.5.70.0070.04720.03
5.5.60.0100.05720.05
5.5.50.0000.04720.15
5.5.40.0070.07319.99
5.5.30.0170.07019.95
5.5.20.0100.04320.11
5.5.10.0070.04019.96
5.5.00.0130.07320.02
5.4.450.0070.05719.21
5.4.440.0030.06719.04
5.4.430.0030.08319.21
5.4.420.0130.03719.25
5.4.410.0130.07319.08
5.4.400.0100.07718.98
5.4.390.0130.05018.78
5.4.380.0100.03318.97
5.4.370.0030.04318.97
5.4.360.0070.04718.72
5.4.350.0100.05319.05
5.4.340.0070.05719.07
5.4.320.0000.07018.98
5.4.310.0030.08018.88
5.4.300.0270.06019.07
5.4.290.0100.07318.88
5.4.280.0100.07718.93
5.4.270.0030.08018.98
5.4.260.0030.04318.96
5.4.250.0070.04018.95
5.4.240.0100.04718.97
5.4.230.0100.08018.96
5.4.220.0100.07718.88
5.4.210.0070.08018.89
5.4.200.0070.04718.89
5.4.190.0130.04018.74
5.4.180.0070.07718.91
5.4.170.0130.03718.97
5.4.160.0100.04319.05
5.4.150.0070.05018.96
5.4.140.0070.07718.16
5.4.130.0030.07718.16
5.4.120.0070.05018.16
5.4.110.0100.06718.16
5.4.100.0070.06018.16
5.4.90.0130.05318.16
5.4.80.0170.06718.16
5.4.70.0100.06318.16
5.4.60.0130.03018.16
5.4.50.0070.06318.16
5.4.40.0030.04018.16
5.4.30.0100.04718.16
5.4.20.0070.07318.16
5.4.10.0130.03018.16
5.4.00.0000.04318.16
5.3.290.0070.04318.16
5.3.280.0100.07318.16
5.3.270.0000.08718.16
5.3.260.0100.07718.16
5.3.250.0030.05018.16
5.3.240.0130.06018.16
5.3.230.0070.08018.16
5.3.220.0070.07018.16
5.3.210.0100.04018.16
5.3.200.0030.05318.16
5.3.190.0030.08318.16
5.3.180.0100.04718.16
5.3.170.0100.07018.16
5.3.160.0170.06718.16
5.3.150.0070.07718.16
5.3.140.0170.05718.16
5.3.130.0170.06718.16
5.3.120.0100.07018.16
5.3.110.0070.08018.16
5.3.100.0070.07318.16
5.3.90.0070.07318.16
5.3.80.0100.07318.16
5.3.70.0100.03318.16
5.3.60.0000.06318.16
5.3.50.0100.03018.16
5.3.40.0070.03318.16
5.3.30.0070.07718.16
5.3.20.0030.08318.16
5.3.10.0070.07318.16
5.3.00.0100.06318.16

preferences:
39.74 ms | 401 KiB | 5 Q