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); print_r(sort($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.0130.00316.38
8.3.50.0090.00921.94
8.3.40.0110.00418.82
8.3.30.0030.01020.35
8.3.20.0040.01120.16
8.3.10.0050.00321.96
8.3.00.0080.00022.37
8.2.180.0120.00918.41
8.2.170.0100.00622.96
8.2.160.0070.00722.17
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0050.00226.16
8.2.120.0080.00021.03
8.2.110.0100.00022.20
8.2.100.0090.00317.91
8.2.90.0040.00419.21
8.2.80.0000.00817.97
8.2.70.0000.01017.63
8.2.60.0000.00918.05
8.2.50.0040.00418.10
8.2.40.0040.00418.34
8.2.30.0000.00818.01
8.2.20.0040.00417.59
8.2.10.0030.00517.74
8.2.00.0090.00317.75
8.1.280.0110.00425.92
8.1.270.0000.00824.66
8.1.260.0080.00026.35
8.1.250.0090.00028.09
8.1.240.0060.00322.20
8.1.230.0040.00817.95
8.1.220.0060.00317.78
8.1.210.0030.00518.77
8.1.200.0060.00317.38
8.1.190.0050.00317.22
8.1.180.0080.00018.10
8.1.170.0000.00818.55
8.1.160.0050.00220.81
8.1.150.0000.00718.52
8.1.140.0000.00917.46
8.1.130.0030.00317.71
8.1.120.0070.00017.37
8.1.110.0000.00817.50
8.1.100.0070.00017.43
8.1.90.0050.00217.50
8.1.80.0050.00317.46
8.1.70.0000.00717.36
8.1.60.0060.00317.53
8.1.50.0050.00317.41
8.1.40.0000.00817.43
8.1.30.0000.00817.63
8.1.20.0030.00517.59
8.1.10.0040.00417.57
8.1.00.0030.00617.38
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0030.00318.47
8.0.270.0050.00217.15
8.0.260.0000.00616.90
8.0.250.0040.00416.95
8.0.240.0030.00616.88
8.0.230.0000.00716.86
8.0.220.0030.00316.90
8.0.210.0030.00316.92
8.0.200.0030.00316.88
8.0.190.0040.00416.95
8.0.180.0030.00616.95
8.0.170.0000.00716.86
8.0.160.0050.00216.89
8.0.150.0040.00416.89
8.0.140.0000.00716.88
8.0.130.0000.00513.27
8.0.120.0040.00416.87
8.0.110.0060.00316.89
8.0.100.0040.00416.93
8.0.90.0040.00416.97
8.0.80.0030.01316.96
8.0.70.0050.00316.97
8.0.60.0040.00416.93
8.0.50.0000.00716.89
8.0.30.0140.00517.29
8.0.20.0140.00517.40
8.0.10.0000.00717.14
8.0.00.0090.00816.63
7.4.330.0040.00215.00
7.4.320.0020.00516.58
7.4.300.0030.00316.50
7.4.290.0030.00516.65
7.4.280.0000.00716.51
7.4.270.0000.00716.55
7.4.260.0040.00416.63
7.4.250.0040.00416.38
7.4.240.0030.00316.56
7.4.230.0040.00416.39
7.4.220.0120.00616.61
7.4.210.0060.01216.60
7.4.200.0040.00416.62
7.4.190.0050.00216.58
7.4.160.0080.01316.23
7.4.150.0140.00517.40
7.4.140.0120.01017.86
7.4.130.0080.01116.62
7.4.120.0100.00716.52
7.4.110.0130.00316.62
7.4.100.0070.01016.57
7.4.90.0110.00716.52
7.4.80.0100.01019.39
7.4.70.0070.01016.63
7.4.60.0060.01016.59
7.4.50.0040.00416.45
7.4.40.0070.01022.77
7.4.30.0160.00316.37
7.4.00.0060.00915.02
7.3.330.0020.00213.32
7.3.320.0030.00313.43
7.3.310.0000.00716.21
7.3.300.0030.00316.32
7.3.290.0030.01316.29
7.3.280.0130.00716.37
7.3.270.0110.00717.40
7.3.260.0140.00416.26
7.3.250.0120.00916.47
7.3.240.0100.01316.57
7.3.230.0070.01016.41
7.3.210.0090.00616.29
7.3.200.0190.00319.39
7.3.190.0090.00916.67
7.3.180.0060.01016.32
7.3.170.0130.00916.29
7.3.160.0080.00816.38
7.3.120.0100.00715.14
7.2.330.0090.00916.55
7.2.320.0200.00316.49
7.2.310.0110.00716.44
7.2.300.0110.01116.75
7.2.290.0080.00816.57
7.2.00.0030.00919.56
7.1.100.0110.00618.06
7.1.70.0030.00516.93
7.1.60.0070.01719.43
7.1.50.0030.01716.95
7.1.00.0030.07322.57
7.0.200.0030.01015.00
7.0.140.0030.07321.95
7.0.110.0100.07719.92
7.0.100.0030.08719.90
7.0.90.0100.08019.97
7.0.80.0000.08720.00
7.0.70.0030.09019.92
7.0.60.0100.08319.94
7.0.50.0070.05719.97
7.0.40.0030.07719.61
7.0.30.0100.08019.73
7.0.20.0030.09019.80
7.0.10.0200.06719.72
7.0.00.0130.04719.76
5.6.280.0000.07721.14
5.6.260.0070.08020.61
5.6.250.0030.07720.68
5.6.240.0170.07720.63
5.6.230.0100.06320.50
5.6.220.0070.07720.50
5.6.210.0070.08720.54
5.6.200.0130.07320.66
5.6.190.0170.07720.55
5.6.180.0170.07320.64
5.6.170.0200.07020.59
5.6.160.0030.08020.51
5.6.150.0030.07720.54
5.6.140.0170.06720.63
5.6.130.0070.08320.52
5.6.120.0070.04720.59
5.6.110.0170.07320.55
5.6.100.0170.07320.53
5.6.90.0130.05020.59
5.6.80.0130.06719.95
5.6.70.0070.07019.96
5.6.60.0100.07320.18
5.6.50.0030.05019.92
5.6.40.0100.05019.96
5.6.30.0070.04319.99
5.6.20.0070.07320.16
5.6.10.0070.04019.86
5.6.00.0100.04019.92
5.5.380.0070.08017.63
5.5.370.0070.07017.59
5.5.360.0030.07017.55
5.5.350.0100.07317.47
5.5.340.0030.06318.10
5.5.330.0070.04317.93
5.5.320.0000.08017.93
5.5.310.0100.04317.93
5.5.300.0070.08318.23
5.5.290.0170.07017.92
5.5.280.0070.06018.09
5.5.270.0070.08017.90
5.5.260.0030.08017.91
5.5.250.0030.05017.86
5.5.240.0070.07317.48
5.5.230.0100.07717.50
5.5.220.0000.07717.51
5.5.210.0030.07717.51
5.5.200.0070.08017.46
5.5.190.0030.08017.26
5.5.180.0070.07317.26
5.5.160.0100.03317.26
5.5.150.0070.04017.45
5.5.140.0070.04017.45
5.5.130.0030.04017.26
5.5.120.0070.03717.45
5.5.110.0100.03317.45
5.5.100.0000.04317.34
5.5.90.0070.03717.16
5.5.80.0070.03717.08
5.5.70.0130.06317.34
5.5.60.0000.04017.33
5.5.50.0070.03717.07
5.5.40.0070.05317.17
5.5.30.0070.04017.16
5.5.20.0070.03717.37
5.5.10.0030.04017.29
5.5.00.0030.04717.02
5.4.450.0030.05319.44
5.4.440.0030.07019.51
5.4.430.0170.05319.46
5.4.420.0130.07319.26
5.4.410.0070.08019.33
5.4.400.0100.07319.29
5.4.390.0170.06719.14
5.4.380.0070.07318.95
5.4.370.0070.07019.11
5.4.360.0070.04719.18
5.4.350.0000.06719.13
5.4.340.0070.06718.96
5.4.320.0000.04719.04
5.4.310.0070.04318.96
5.4.300.0030.03719.04
5.4.290.0030.04018.96
5.4.280.0100.03318.95
5.4.270.0070.03019.04
5.4.260.0000.04019.04
5.4.250.0070.03019.13
5.4.240.0100.03019.27
5.4.230.0000.07318.95
5.4.220.0030.04718.97
5.4.210.0030.05319.27
5.4.200.0030.03719.18
5.4.190.0070.03319.03
5.4.180.0100.03718.92
5.4.170.0000.04018.94
5.4.160.0100.03019.16
5.4.150.0070.03719.27
5.4.140.0000.04016.51
5.4.130.0030.03716.59
5.4.120.0100.02716.57
5.4.110.0100.03016.36
5.4.100.0030.03316.52
5.4.90.0070.03316.51
5.4.80.0070.03016.25
5.4.70.0030.03716.59
5.4.60.0000.03716.58
5.4.50.0030.04016.51
5.4.40.0030.03016.54
5.4.30.0000.04016.48
5.4.20.0070.03016.33
5.4.10.0130.02316.39
5.4.00.0070.03015.93
5.3.290.0000.04314.75
5.3.280.0000.06314.82
5.3.270.0030.03714.64
5.3.260.0000.04014.68
5.3.250.0030.04014.75
5.3.240.0000.04014.69
5.3.230.0030.04014.64
5.3.220.0030.05714.57
5.3.210.0070.03314.52
5.3.200.0070.04014.56
5.3.190.0000.04014.53
5.3.180.0000.04014.57
5.3.170.0100.03014.58
5.3.160.0030.04014.65
5.3.150.0070.06314.42
5.3.140.0070.04314.68
5.3.130.0000.04014.55
5.3.120.0070.03314.54
5.3.110.0070.05714.69
5.3.100.0000.03714.02
5.3.90.0070.03314.04
5.3.80.0070.03314.25
5.3.70.0030.03714.10
5.3.60.0070.03313.99
5.3.50.0070.04314.04
5.3.40.0030.05314.18
5.3.30.0000.03313.91
5.3.20.0130.06313.65
5.3.10.0070.07013.68
5.3.00.0100.04013.63
5.2.170.0030.02311.28
5.2.160.0000.03011.15
5.2.150.0000.04011.27
5.2.140.0000.05311.13
5.2.130.0000.06711.18
5.2.120.0070.05711.24
5.2.110.0030.04311.18
5.2.100.0070.03711.11
5.2.90.0000.05711.11
5.2.80.0130.05311.12
5.2.70.0100.03011.06
5.2.60.0030.06011.02
5.2.50.0070.05711.01
5.2.40.0100.05311.01
5.2.30.0030.06010.95
5.2.20.0070.06011.12
5.2.10.0070.05310.94
5.2.00.0030.03010.86
5.1.60.0000.0279.99
5.1.50.0030.0539.99
5.1.40.0030.04710.06
5.1.30.0100.05310.36
5.1.20.0070.04010.48
5.1.10.0070.05310.13
5.1.00.0100.05010.07
5.0.50.0000.0308.51
5.0.40.0030.0208.39
5.0.30.0000.0478.21
5.0.20.0030.0238.29
5.0.10.0070.0378.18
5.0.00.0030.0578.13
4.4.90.0030.0377.48
4.4.80.0000.0377.48
4.4.70.0030.0337.48
4.4.60.0070.0307.48
4.4.50.0000.0277.48
4.4.40.0000.0537.48
4.4.30.0030.0307.48
4.4.20.0030.0337.48
4.4.10.0000.0337.48
4.4.00.0070.0477.48
4.3.110.0000.0307.48
4.3.100.0000.0307.48
4.3.90.0000.0177.48
4.3.80.0030.0537.48
4.3.70.0000.0337.48
4.3.60.0000.0337.48
4.3.50.0030.0337.48
4.3.40.0000.0437.48
4.3.30.0030.0237.48
4.3.20.0030.0337.48
4.3.10.0000.0407.48
4.3.00.0030.0307.48

preferences:
42.98 ms | 401 KiB | 5 Q