3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = "hey"; function string_getpermutations($prefix, $characters, &$permutations) { if (count($characters) == 1) $permutations[] = $prefix . array_pop($characters); else { for ($i = 0; $i < count($characters); $i++) { $tmp = $characters; unset($tmp[$i]); string_getpermutations($prefix . $characters[$i], array_values($tmp), $permutations); } } } $characters = array(); for ($i = 0; $i < strlen($input); $i++) $characters[] = $input[$i]; $permutations = array(); print_r($characters); string_getpermutations("", $characters, $permutations); sort($permutations); print_r(($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.3.60.0170.00016.63
8.3.50.0130.00721.98
8.3.40.0090.00618.92
8.3.30.0030.01020.29
8.3.20.0070.00720.15
8.3.10.0070.00022.11
8.3.00.0000.00822.64
8.2.180.0120.00916.50
8.2.170.0140.00022.96
8.2.160.0120.00318.66
8.2.150.0060.00324.18
8.2.140.0090.00024.66
8.2.130.0040.00426.16
8.2.120.0100.00019.14
8.2.110.0060.00322.13
8.2.100.0040.00817.84
8.2.90.0090.00019.10
8.2.80.0050.00219.42
8.2.70.0060.00617.34
8.2.60.0040.00417.93
8.2.50.0080.00018.07
8.2.40.0050.00318.34
8.2.30.0000.00918.21
8.2.20.0080.00017.66
8.2.10.0040.00417.77
8.2.00.0040.00817.76
8.1.280.0090.00925.92
8.1.270.0050.00324.66
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0080.00023.97
8.1.230.0110.00018.94
8.1.220.0040.00417.74
8.1.210.0090.00018.77
8.1.200.0060.00317.35
8.1.190.0040.00417.41
8.1.180.0080.00019.01
8.1.170.0000.00918.63
8.1.160.0000.00720.89
8.1.150.0000.00818.58
8.1.140.0030.00517.36
8.1.130.0030.00317.75
8.1.120.0000.00817.46
8.1.110.0040.00417.48
8.1.100.0020.00517.36
8.1.90.0000.00817.46
8.1.80.0050.00217.44
8.1.70.0000.00717.45
8.1.60.0080.00017.52
8.1.50.0040.00417.53
8.1.40.0040.00417.43
8.1.30.0040.00417.48
8.1.20.0000.00817.56
8.1.10.0000.00817.48
8.1.00.0060.00617.38
8.0.300.0080.00018.77
8.0.290.0000.00817.18
8.0.280.0000.00718.42
8.0.270.0030.00317.22
8.0.260.0030.00316.80
8.0.250.0000.00716.98
8.0.240.0080.00016.86
8.0.230.0030.00316.94
8.0.220.0030.00316.93
8.0.210.0030.00316.89
8.0.200.0000.00716.86
8.0.190.0020.00516.86
8.0.180.0040.00416.86
8.0.170.0000.00716.80
8.0.160.0030.00316.75
8.0.150.0030.00316.75
8.0.140.0080.00016.88
8.0.130.0060.00013.36
8.0.120.0050.00316.83
8.0.110.0000.00816.87
8.0.100.0030.00316.83
8.0.90.0040.00416.96
8.0.80.0100.00616.90
8.0.70.0040.00416.75
8.0.60.0050.00316.74
8.0.50.0070.00016.84
8.0.30.0050.01717.05
8.0.20.0120.00717.40
8.0.10.0000.00816.98
8.0.00.0130.00716.69
7.4.330.0030.00315.00
7.4.320.0060.00016.59
7.4.300.0030.00316.50
7.4.290.0030.00316.51
7.4.280.0070.00016.36
7.4.270.0030.00316.50
7.4.260.0000.00716.51
7.4.250.0000.00816.57
7.4.240.0030.00516.49
7.4.230.0000.00616.61
7.4.220.0120.00616.58
7.4.210.0060.01016.55
7.4.200.0040.00416.64
7.4.190.0040.00416.39
7.4.160.0030.01416.55
7.4.150.0100.00717.40
7.4.140.0100.00717.86
7.4.130.0110.00616.53
7.4.120.0130.00316.51
7.4.110.0070.01016.50
7.4.100.0030.01416.68
7.4.90.0100.01316.63
7.4.80.0130.01019.39
7.4.70.0110.00616.66
7.4.60.0070.01116.47
7.4.50.0050.00316.34
7.4.40.0100.00622.77
7.4.30.0060.00916.66
7.4.00.0060.00915.14
7.3.330.0020.00213.18
7.3.320.0070.00013.39
7.3.310.0000.00716.42
7.3.300.0000.00716.42
7.3.290.0060.00916.28
7.3.280.0080.01016.32
7.3.270.0070.01017.40
7.3.260.0090.00916.49
7.3.250.0150.00416.50
7.3.240.0150.00416.38
7.3.230.0080.00816.56
7.3.210.0120.00616.57
7.3.200.0070.01019.39
7.3.190.0090.00916.27
7.3.180.0120.00316.33
7.3.170.0000.01616.43
7.3.160.0060.01016.43
7.3.120.0030.01414.98
7.3.110.0030.01014.90
7.3.100.0100.00714.75
7.3.90.0070.00714.82
7.3.80.0000.01714.57
7.3.70.0070.01014.95
7.3.60.0120.00315.00
7.3.50.0070.00714.72
7.3.40.0000.01314.60
7.3.30.0070.01014.86
7.3.20.0070.00716.69
7.3.10.0120.00016.55
7.3.00.0090.00616.67
7.2.330.0140.00316.77
7.2.320.0160.00316.61
7.2.310.0130.01016.44
7.2.300.0110.00716.43
7.2.290.0120.00316.65
7.2.240.0070.00715.08
7.2.230.0000.01814.98
7.2.220.0080.00415.04
7.2.210.0030.01214.96
7.2.200.0070.00715.22
7.2.190.0120.00414.89
7.2.180.0040.01115.16
7.2.170.0110.00715.06
7.2.160.0090.00615.10
7.2.150.0070.00716.84
7.2.140.0070.01017.13
7.2.130.0100.00316.94
7.2.120.0110.00716.92
7.2.110.0060.00916.77
7.2.100.0110.00417.03
7.2.90.0060.00617.06
7.2.80.0060.01017.02
7.2.70.0000.01616.91
7.2.60.0040.01216.74
7.2.50.0050.00517.04
7.2.40.0040.01416.63
7.2.30.0130.00317.01
7.2.20.0040.01116.71
7.2.10.0040.01216.89
7.2.00.0070.00416.77
7.1.330.0030.01015.59
7.1.320.0070.01015.97
7.1.310.0110.00415.76
7.1.300.0030.01015.63
7.1.290.0090.00616.04
7.1.280.0040.00816.00
7.1.270.0040.01115.82
7.1.260.0090.00615.81
7.1.250.0150.00015.95
7.1.70.0050.00217.11
7.1.60.0110.01419.43
7.1.50.0040.01517.04
7.1.00.0030.03322.41
7.0.200.0100.00314.95
7.0.140.0070.07022.09
7.0.60.0000.04319.93
7.0.50.0100.07717.87
7.0.40.0070.04720.13
7.0.30.0170.04320.06
7.0.20.0270.05020.24
7.0.10.0270.03720.30
7.0.00.0130.07720.18
5.6.280.0030.07321.02
5.6.210.0200.06720.54
5.6.200.0100.05718.14
5.6.190.0070.07720.76
5.6.180.0200.03720.61
5.6.170.0330.07020.51
5.6.160.0030.04020.52
5.6.150.0100.07718.17
5.6.140.0030.05718.18
5.6.130.0200.06718.27
5.6.120.0130.07720.98
5.6.110.0030.08320.89
5.6.100.0070.08321.14
5.6.90.0100.06020.95
5.6.80.0170.06020.35
5.6.70.0230.04020.36
5.5.350.0000.08320.38
5.5.340.0030.06718.09
5.5.330.0100.08020.56
5.5.320.0330.07020.29
5.5.310.0270.07320.39
5.5.300.0030.04717.98
5.5.290.0030.04018.04
5.5.280.0030.07720.80
5.5.270.0170.07020.68
5.5.260.0130.07720.76
5.5.250.0030.08020.46
5.5.240.0070.04720.29
5.4.450.0230.05719.41
5.4.440.0400.06319.21
5.4.430.0430.06019.48
5.4.420.0330.07319.63
5.4.410.0270.07019.28
5.4.400.0330.06019.07
5.4.390.0270.03319.16
5.4.380.0230.04019.13
5.4.370.0270.06719.09
5.4.360.0270.05319.06
5.4.350.0300.07019.09
5.4.340.0200.06019.32
5.4.320.0200.04319.09
5.4.310.0300.06719.33
5.4.300.0270.03318.85
5.4.290.0300.05719.00
5.4.280.0330.04719.16
5.4.270.0330.04319.06
5.4.260.0230.04019.13
5.4.250.0270.05719.15
5.4.240.0300.03718.84
5.4.230.0200.04019.08
5.4.220.0270.03718.85
5.4.210.0200.04019.19
5.4.200.0270.05319.22
5.4.190.0270.03319.08
5.4.180.0230.07319.05
5.4.170.0270.06319.13
5.4.160.0330.04019.07
5.4.150.0270.07018.99
5.4.140.0230.04316.42
5.4.130.0230.06716.35
5.4.120.0200.04716.39
5.4.110.0130.04716.46
5.4.100.0270.06716.57
5.4.90.0230.03316.51
5.4.80.0300.06316.39
5.4.70.0230.04716.54
5.4.60.0400.05716.51
5.4.50.0300.03316.56
5.4.40.0270.07016.43
5.4.30.0270.04716.16
5.4.20.0400.05016.52
5.4.10.0330.06716.55
5.4.00.0370.06715.96
5.3.290.0230.03714.59
5.3.280.0270.07714.71
5.3.270.0300.07714.63
5.3.260.0230.05014.53
5.3.250.0270.07014.61
5.3.240.0200.03714.52
5.3.230.0200.05314.60
5.3.220.0230.04014.62
5.3.210.0200.07014.57
5.3.200.0130.04014.54
5.3.190.0200.03714.65
5.3.180.0200.06014.57
5.3.170.0170.05314.47
5.3.160.0330.06714.48
5.3.150.0270.04014.53
5.3.140.0200.04014.61
5.3.130.0300.07314.47
5.3.120.0300.07014.55
5.3.110.0200.05014.54
5.3.100.0270.05314.15
5.3.90.0300.07014.03
5.3.80.0300.04314.18
5.3.70.0530.02013.95
5.3.60.0400.03013.98
5.3.50.0370.03314.04
5.3.40.0300.06313.87
5.3.30.0370.05713.81
5.3.20.0230.03713.81
5.3.10.0230.03713.57
5.3.00.0300.04013.55
5.2.170.0300.03011.20
5.2.160.0300.04011.07
5.2.150.0170.04011.22
5.2.140.0200.03311.15
5.2.130.0230.05711.03
5.2.120.0230.04011.06
5.2.110.0270.03011.10
5.2.100.0230.06011.34
5.2.90.0230.05311.08
5.2.80.0130.04311.10
5.2.70.0270.05711.26
5.2.60.0200.04711.00
5.2.50.0270.04011.11
5.2.40.0170.05311.11
5.2.30.0130.06010.89
5.2.20.0130.05010.86
5.2.10.0230.04310.87
5.2.00.0230.04710.72
5.1.60.0170.0539.89
5.1.50.0200.0409.93
5.1.40.0230.0439.96
5.1.30.0130.04010.42
5.1.20.0170.03010.27
5.1.10.0170.02010.05
5.1.00.0170.03710.30
5.0.50.0030.0309.66
5.0.40.0200.0239.66
5.0.30.0070.0379.66
5.0.20.0130.0379.66
5.0.10.0130.0339.66
5.0.00.0070.0439.66
4.4.90.0030.0209.66
4.4.80.0070.0139.66
4.4.70.0100.0309.66
4.4.60.0100.0379.66
4.4.50.0070.0239.66
4.4.40.0030.0509.66
4.4.30.0100.0309.66
4.4.20.0130.0309.66
4.4.10.0070.0179.66
4.4.00.0070.0579.66
4.3.110.0070.0309.66
4.3.100.0130.0109.66
4.3.90.0100.0239.66
4.3.80.0130.0479.66
4.3.70.0130.0209.66
4.3.60.0070.0279.66
4.3.50.0100.0339.66
4.3.40.0100.0409.66
4.3.30.0030.0379.66
4.3.20.0000.0279.66
4.3.10.0100.0309.66
4.3.00.0100.0279.66

preferences:
48.6 ms | 401 KiB | 5 Q