3v4l.org

run code in 300+ PHP versions simultaneously
<?php function permStacker($array,$length){ $stack=[[]]; // declare intitial empty element for($x=0; $x<$length; ++$x){ // limit the total number of passes / max string length foreach($stack as $combination){ foreach(array_diff($array,range('a',end($combination))) as $left){ // do not include iterate letter that come earlier than rightmost letter $merge=array_merge($combination,[$left]); $stack[implode($merge)]=$merge; // keys hold desired strings, values hold subarray of combinations for iterated referencing } } } unset($stack[0]); // remove initial empty element return array_keys($stack); // return array of permutations as space delimited strings } $permutations=permStacker(range('a','h'),4); echo 'Total Permutations: ',sizeof($permutations),"\n"; var_export($permutations);

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.4.140.0130.00817.85
8.4.130.0120.00918.02
8.4.120.0130.00824.00
8.4.110.0090.01122.65
8.4.100.0090.00417.98
8.4.90.0110.01117.77
8.4.80.0110.00922.42
8.4.70.0120.01018.15
8.4.60.0090.01119.06
8.4.50.0130.00818.76
8.4.40.0100.01019.61
8.4.30.0130.00619.51
8.4.20.0080.01519.75
8.4.10.0090.00317.98
8.3.270.0130.00816.70
8.3.260.0120.00716.98
8.3.250.0140.00519.22
8.3.240.0080.01117.23
8.3.230.0100.01016.91
8.3.220.0120.00617.18
8.3.210.0070.01017.17
8.3.200.0070.00116.82
8.3.190.0100.00916.75
8.3.180.0050.00318.98
8.3.170.0000.00720.61
8.3.160.0140.00718.77
8.3.150.0140.00716.71
8.3.140.0040.00418.86
8.3.130.0080.00018.36
8.3.120.0070.00418.71
8.3.110.0110.00420.94
8.3.100.0100.00016.89
8.3.90.0030.00526.77
8.3.80.0070.00318.55
8.3.70.0000.01916.75
8.3.60.0180.00018.43
8.3.50.0090.01017.53
8.3.40.0100.00718.71
8.3.30.0130.01018.88
8.3.20.0000.00820.16
8.3.10.0040.00423.64
8.3.00.0040.00423.70
8.2.290.0130.00619.12
8.2.280.0100.00618.39
8.2.270.0120.00822.21
8.2.260.0070.00716.58
8.2.250.0030.00618.48
8.2.240.0090.00018.66
8.2.230.0110.00022.58
8.2.220.0000.00824.06
8.2.210.0100.01026.77
8.2.200.0030.01016.63
8.2.190.0070.01116.58
8.2.180.0130.00718.16
8.2.170.0080.00822.96
8.2.160.0000.01420.45
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0070.00022.13
8.2.120.0090.00026.35
8.2.110.0060.00321.12
8.2.100.0080.00417.91
8.2.90.0000.00818.47
8.2.80.0040.00418.05
8.2.70.0080.00018.15
8.2.60.0030.00918.28
8.2.50.0080.00018.10
8.2.40.0090.00020.63
8.2.30.0000.00821.09
8.2.20.0050.00218.17
8.2.10.0030.00518.13
8.2.00.0050.00218.12
8.1.330.0120.00821.98
8.1.320.0080.01216.35
8.1.310.0090.00018.55
8.1.300.0110.00818.42
8.1.290.0070.00430.84
8.1.280.0110.00425.92
8.1.270.0040.00423.84
8.1.260.0000.00726.35
8.1.250.0080.00028.09
8.1.240.0100.00320.95
8.1.230.0110.00021.16
8.1.220.0000.00817.89
8.1.210.0080.00018.77
8.1.200.0070.00317.48
8.1.190.0030.00617.22
8.1.180.0050.00318.10
8.1.170.0060.00318.70
8.1.160.0050.00319.11
8.1.150.0000.00820.71
8.1.140.0000.00717.90
8.1.130.0000.01019.06
8.1.120.0090.00017.54
8.1.110.0050.00317.53
8.1.100.0040.00717.66
8.1.90.0000.00717.70
8.1.80.0090.00017.62
8.1.70.0050.00217.67
8.1.60.0050.00317.68
8.1.50.0080.00017.78
8.1.40.0080.00017.67
8.1.30.0080.00017.83
8.1.20.0090.00017.72
8.1.10.0040.00417.80
8.1.00.0090.00017.64
8.0.300.0070.00020.10
8.0.290.0000.00816.63
8.0.280.0080.00018.60
8.0.270.0040.00416.97
8.0.260.0030.00316.91
8.0.250.0000.00817.18
8.0.240.0040.00417.01
8.0.230.0000.00716.97
8.0.220.0070.00016.98
8.0.210.0050.00217.06
8.0.200.0000.00617.06
8.0.190.0090.00017.11
8.0.180.0050.00317.08
8.0.170.0040.00417.07
8.0.160.0040.00417.00
8.0.150.0050.00416.87
8.0.140.0090.00016.89
8.0.130.0000.00613.43
8.0.120.0060.00317.04
8.0.110.0000.00716.94
8.0.100.0050.00217.10
8.0.90.0040.00417.03
8.0.80.0130.00317.01
8.0.70.0080.00016.93
8.0.60.0050.00317.07
8.0.50.0070.00016.95
8.0.30.0070.01017.35
8.0.20.0120.00917.40
8.0.10.0040.00417.21
8.0.00.0060.01516.98
7.4.330.0000.00516.79
7.4.320.0000.00716.66
7.4.300.0020.00516.66
7.4.290.0030.00316.57
7.4.280.0040.00416.65
7.4.270.0040.00316.76
7.4.260.0000.00816.60
7.4.250.0070.00016.64
7.4.240.0040.00416.78
7.4.230.0090.00016.65
7.4.220.0040.01716.74
7.4.210.0080.00716.80
7.4.200.0030.00316.84
7.4.160.0070.01016.51
7.4.150.0030.01517.40
7.4.140.0110.01217.86
7.4.130.0110.00716.64
7.4.120.0120.00716.67
7.4.110.0130.00316.60
7.4.100.0130.00416.58
7.4.90.0250.00016.59
7.4.80.0090.01219.39
7.4.70.0090.00916.82
7.4.60.0060.00916.66
7.4.50.0030.01416.34
7.4.40.0190.00316.46
7.4.30.0070.01116.46
7.4.20.0040.01716.79
7.4.10.0110.01016.67
7.4.00.0110.00715.62
7.3.330.0030.00313.53
7.3.320.0050.00013.50
7.3.310.0000.00716.52
7.3.300.0000.00716.51
7.3.290.0000.00716.50
7.3.280.0060.01016.49
7.3.270.0030.01617.40
7.3.260.0100.01216.70
7.3.250.0120.01016.78
7.3.240.0120.01016.69
7.3.230.0030.01316.64
7.3.210.0120.00616.63
7.3.200.0100.00716.57
7.3.190.0060.01016.39
7.3.180.0070.01316.46
7.3.170.0170.00016.52
7.3.160.0200.00016.49
7.3.150.0100.00716.29
7.3.140.0040.01316.44
7.3.130.0090.00916.47
7.3.120.0030.01115.52
7.3.110.0090.00715.78
7.3.100.0110.00715.55
7.3.90.0090.01115.76
7.3.80.0090.00815.85
7.3.70.0090.01115.65
7.3.60.0080.00915.74
7.3.50.0080.00915.61
7.3.40.0070.00915.61
7.3.30.0080.00915.76
7.3.20.0110.00516.47
7.3.10.0100.00616.67
7.3.00.0100.00716.67
7.2.330.0090.01016.89
7.2.320.0120.00616.84
7.2.310.0100.01616.66
7.2.300.0030.02016.91
7.2.290.0130.00316.61
7.2.280.0040.01416.89
7.2.270.0120.00816.62
7.2.260.0120.00616.88
7.2.250.0100.00816.13
7.2.240.0080.01116.02
7.2.230.0100.00815.87
7.2.220.0080.01215.91
7.2.210.0080.01116.14
7.2.200.0070.01415.98
7.2.190.0120.00615.93
7.2.180.0100.00816.05
7.2.170.0060.01215.81
7.2.160.0140.00316.85
7.2.150.0120.00916.70
7.2.140.0160.00316.75
7.2.130.0040.01616.92
7.2.120.0300.01116.18
7.2.110.0460.00716.24
7.2.100.0590.01016.12
7.2.90.0650.01016.26
7.2.80.0660.00516.19
7.2.70.0380.00816.33
7.2.60.0530.00916.29
7.2.50.0460.00916.28
7.2.40.0600.00716.68
7.2.30.0550.01016.63
7.2.20.0710.00816.65
7.2.10.0680.00916.74
7.2.00.0960.00916.65
7.1.330.0070.01315.56
7.1.320.0080.00915.65
7.1.310.0140.00915.74
7.1.300.0140.00415.74
7.1.290.0090.00715.75
7.1.280.0130.00615.76
7.1.270.0120.00815.68
7.1.260.0100.01015.68
7.1.250.0120.01015.77
7.1.240.0570.00714.78
7.1.230.0860.01314.73
7.1.220.0830.00914.85
7.1.210.0560.00414.82
7.1.200.0760.00915.25
7.1.190.0870.01014.97
7.1.180.0880.00814.87
7.1.170.0490.00815.04
7.1.160.0890.00915.48
7.1.150.1070.01115.51
7.1.140.0960.01115.35
7.1.130.1080.00915.67
7.1.120.1110.01015.53
7.1.110.0630.01216.09
7.1.100.0880.00816.01
7.1.90.1470.00715.93
7.1.80.0810.01115.98
7.1.70.0780.00615.63
7.1.60.0870.01024.50
7.1.50.0780.01224.34
7.1.40.0800.00624.26
7.1.30.0890.01124.27
7.1.20.0640.01124.32
7.1.10.0400.00815.28
7.1.00.0590.00815.41
7.0.330.0140.01115.51
7.0.320.0470.00614.68
7.0.310.0580.01214.55
7.0.300.0470.00814.51
7.0.290.1200.00715.19
7.0.280.0640.00914.36
7.0.270.0870.00515.11
7.0.260.0960.01015.31
7.0.250.0550.01015.66
7.0.240.0760.01015.75
7.0.230.0620.01115.75
7.0.220.0860.00715.76
7.0.210.0800.01115.08
7.0.200.0670.01115.27
7.0.190.0780.01115.12
7.0.180.0740.01014.92
7.0.170.0600.00815.12
7.0.160.0510.01015.01
7.0.150.0500.00915.05
7.0.140.0530.00815.04
7.0.130.0410.01315.09
7.0.120.0750.01115.15
7.0.110.0390.01215.01
7.0.100.0550.01115.14
7.0.90.0690.00814.97
7.0.80.0580.01215.10
7.0.70.0460.01014.99
7.0.60.0560.00914.88
7.0.50.0470.00914.97
7.0.40.0440.00815.12
7.0.30.0510.01015.14
7.0.20.0510.00815.05
7.0.10.0820.01014.98
7.0.00.0500.00915.01
5.6.400.0130.01016.24
5.6.390.0120.01616.00
5.6.380.0120.01215.33
5.6.370.0160.00815.79
5.6.360.0150.01916.14
5.6.350.0220.01415.84
5.6.340.0170.01715.68
5.6.330.0170.00915.74
5.6.320.0120.01616.00
5.6.310.0180.00915.77
5.6.300.0170.01415.81
5.6.290.0160.01316.23
5.6.280.0130.00815.87
5.6.270.0170.01316.30
5.6.260.0180.01016.18
5.6.250.0190.01116.15
5.6.240.0210.00916.05
5.6.230.0200.00916.30
5.6.220.0240.00916.19
5.6.210.0210.01215.92
5.6.200.0320.00316.06
5.6.190.0280.00316.06
5.6.180.0220.01116.00
5.6.170.0170.01215.92
5.6.160.0220.00816.02
5.6.150.0140.01416.23
5.6.140.0220.00716.02
5.6.130.0090.02216.11
5.6.120.0150.01516.05
5.6.110.0120.02016.05
5.6.100.0310.00016.00
5.6.90.0200.00816.11
5.6.80.0180.00915.88
5.6.70.0220.01316.17
5.6.60.0180.01316.03
5.6.50.0170.01315.92
5.6.40.0120.02015.98
5.6.30.0280.00316.11
5.6.20.0240.00716.11
5.6.10.0190.01415.99
5.6.00.0240.00615.88

preferences:
31.73 ms | 403 KiB | 5 Q