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($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.0060.01616.62
8.3.50.0070.01122.11
8.3.40.0110.00318.67
8.3.30.0030.01220.35
8.3.20.0000.00720.30
8.3.10.0080.00022.10
8.3.00.0050.00322.51
8.2.180.0100.00717.00
8.2.170.0090.00922.96
8.2.160.0030.01022.08
8.2.150.0060.00324.18
8.2.140.0030.00624.66
8.2.130.0050.00326.16
8.2.120.0100.00019.32
8.2.110.0070.00322.28
8.2.100.0080.00417.97
8.2.90.0030.00519.34
8.2.80.0000.00818.14
8.2.70.0050.00317.50
8.2.60.0030.00517.93
8.2.50.0080.00018.10
8.2.40.0000.00718.22
8.2.30.0030.00518.02
8.2.20.0040.00417.73
8.2.10.0040.00417.64
8.2.00.0030.00617.80
8.1.280.0100.00725.92
8.1.270.0070.00024.66
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00020.93
8.1.230.0110.00017.83
8.1.220.0040.00417.76
8.1.210.0030.00618.77
8.1.200.0030.00617.35
8.1.190.0000.00817.23
8.1.180.0050.00318.10
8.1.170.0050.00318.59
8.1.160.0000.00720.75
8.1.150.0000.00718.65
8.1.140.0030.00617.46
8.1.130.0000.00717.74
8.1.120.0040.00417.46
8.1.110.0040.00417.48
8.1.100.0070.00017.46
8.1.90.0000.00717.50
8.1.80.0020.00517.34
8.1.70.0040.00417.50
8.1.60.0030.00617.50
8.1.50.0040.00417.53
8.1.40.0030.00517.54
8.1.30.0000.00817.62
8.1.20.0050.00317.69
8.1.10.0000.00817.45
8.1.00.0040.00717.44
8.0.300.0050.00218.77
8.0.290.0020.00516.63
8.0.280.0040.00418.38
8.0.270.0030.00317.19
8.0.260.0060.00016.84
8.0.250.0070.00017.03
8.0.240.0000.00716.95
8.0.230.0000.00716.87
8.0.220.0030.00316.92
8.0.210.0030.00416.86
8.0.200.0000.00716.92
8.0.190.0040.00416.90
8.0.180.0040.00416.77
8.0.170.0040.00416.79
8.0.160.0040.00416.88
8.0.150.0000.00716.88
8.0.140.0000.00816.83
8.0.130.0050.00013.31
8.0.120.0000.00816.86
8.0.110.0000.00716.81
8.0.100.0050.00216.79
8.0.90.0040.00416.97
8.0.80.0030.01216.88
8.0.70.0000.00716.71
8.0.60.0080.00016.77
8.0.50.0040.00416.96
8.0.30.0050.01317.03
8.0.20.0080.01117.40
8.0.10.0000.00816.90
8.0.00.0080.01116.84
7.4.330.0030.00315.00
7.4.320.0060.00016.55
7.4.300.0000.00716.44
7.4.290.0030.00316.49
7.4.280.0000.00716.63
7.4.270.0030.00316.45
7.4.260.0040.00416.61
7.4.250.0070.00016.58
7.4.240.0020.00516.54
7.4.230.0070.00016.41
7.4.220.0060.01516.57
7.4.210.0080.00616.62
7.4.200.0000.00816.52
7.4.190.0030.00516.77
7.4.160.0090.00616.47
7.4.150.0140.00317.40
7.4.140.0120.00517.86
7.4.130.0100.00916.51
7.4.120.0080.00816.57
7.4.110.0130.00316.59
7.4.100.0060.01616.67
7.4.90.0030.01516.57
7.4.80.0090.00919.39
7.4.70.0150.00316.59
7.4.60.0100.00716.38
7.4.50.0000.00816.41
7.4.40.0070.01022.77
7.4.30.0090.01216.43
7.4.00.0070.00814.97
7.3.330.0000.00513.33
7.3.320.0000.00613.17
7.3.310.0050.00216.26
7.3.300.0040.00416.36
7.3.290.0130.00716.38
7.3.280.0120.00416.38
7.3.270.0080.00817.40
7.3.260.0060.01216.28
7.3.250.0080.01016.45
7.3.240.0080.00816.48
7.3.230.0130.00316.39
7.3.210.0060.00916.54
7.3.200.0130.00419.39
7.3.190.0150.00816.32
7.3.180.0130.00316.68
7.3.170.0030.01416.61
7.3.160.0060.01016.48
7.3.120.0060.01114.87
7.3.110.0060.01314.77
7.3.100.0070.01014.74
7.3.90.0090.00615.03
7.3.80.0040.01114.94
7.3.70.0030.00914.95
7.3.60.0090.00614.68
7.3.50.0040.00414.64
7.3.40.0090.00314.82
7.3.30.0070.00314.76
7.3.20.0100.00316.53
7.3.10.0120.00216.41
7.3.00.0050.00816.41
7.2.330.0060.01516.74
7.2.320.0170.00316.57
7.2.310.0100.00716.42
7.2.300.0060.01816.77
7.2.290.0060.01116.71
7.2.250.0120.00415.25
7.2.240.0060.01215.02
7.2.230.0000.01514.84
7.2.220.0030.01414.64
7.2.210.0030.01315.17
7.2.200.0080.00615.19
7.2.190.0030.01214.94
7.2.180.0060.00314.66
7.2.170.0080.00615.11
7.2.130.0110.00716.66
7.2.120.0070.00816.94
7.2.110.0070.00616.63
7.2.100.0080.00516.96
7.2.90.0090.00716.59
7.2.80.0050.01116.85
7.2.70.0060.00916.86
7.2.60.0100.01016.74
7.2.50.0130.00716.72
7.2.40.0100.00816.66
7.2.30.0160.00316.60
7.2.20.0100.01016.61
7.2.10.0090.01216.93
7.2.00.0090.01216.85
7.1.330.0000.01515.62
7.1.320.0030.01015.89
7.1.310.0070.00815.83
7.1.300.0090.00615.65
7.1.290.0070.00715.84
7.1.280.0070.00715.68
7.1.270.0040.00415.81
7.1.260.0000.00915.80
7.1.250.0100.00215.84
7.1.200.0110.00015.75
7.1.70.0000.01016.91
7.1.60.0090.01519.43
7.1.50.0090.01316.87
7.1.00.0030.07322.46
7.0.200.0350.00314.39
7.0.140.0100.06722.16
7.0.60.0070.04719.76
7.0.50.0130.05717.88
7.0.40.0100.06020.40
7.0.30.0300.08020.23
7.0.20.0170.09020.22
7.0.10.0300.07020.19
7.0.00.0130.08320.20
5.6.280.0130.06720.91
5.6.210.0070.05020.73
5.6.200.0070.08318.18
5.6.190.0030.04320.32
5.6.180.0170.08320.63
5.6.170.0270.03720.45
5.6.160.0070.04020.61
5.6.150.0070.06318.18
5.6.140.0100.03318.22
5.6.130.0170.07318.12
5.6.120.0070.08321.04
5.6.110.0200.08021.12
5.6.100.0100.07321.14
5.6.90.0070.08021.13
5.6.80.0030.05320.38
5.6.70.0230.04320.43
5.5.350.0070.08320.38
5.5.340.0030.04718.07
5.5.330.0070.07720.30
5.5.320.0300.07020.37
5.5.310.0270.08320.38
5.5.300.0070.08017.94
5.5.290.0030.04317.96
5.5.280.0000.05720.80
5.5.270.0070.06020.79
5.5.260.0100.08020.86
5.5.250.0070.08020.46
5.5.240.0070.06320.24
5.4.450.0630.05319.45
5.4.440.0270.05019.30
5.4.430.1000.04319.47
5.4.420.1130.05719.38
5.4.410.1170.06719.48
5.4.400.0870.05018.54
5.4.390.1130.05318.80
5.4.380.0270.05318.52
5.4.370.0230.04318.70
5.4.360.0170.05018.75
5.4.350.0120.04512.02
5.4.340.0080.03712.02
5.4.320.0110.03212.51
5.4.310.0050.05012.50
5.4.300.0030.03912.50
5.4.290.0050.03912.50
5.4.280.0040.03712.40
5.4.270.0060.03512.40
5.4.260.0090.03712.40
5.4.250.0040.03912.39
5.4.240.0100.05018.95
5.4.230.0070.05018.71
5.4.220.0100.06018.78
5.4.210.0070.05318.88
5.4.200.0100.05718.96
5.4.190.0100.06318.84
5.4.180.0030.05318.68
5.4.170.0000.06318.78
5.4.160.0170.05318.92
5.4.150.0230.03718.93
5.4.140.0070.05316.40
5.4.130.0030.05016.58
5.4.120.0200.04716.30
5.4.110.0100.05016.30
5.4.100.0000.06016.41
5.4.90.0070.05316.51
5.4.80.0070.05016.43
5.4.70.0030.05316.48
5.4.60.0130.04316.57
5.4.50.0070.05316.57
5.4.40.0030.07316.38
5.4.30.0130.04716.48
5.4.20.0030.06016.30
5.4.10.0130.06716.32
5.4.00.0070.05715.84
5.3.290.0060.03912.80
5.3.280.0100.04714.82
5.3.270.0030.05714.68
5.3.260.0100.06714.78
5.3.250.0130.06714.78
5.3.240.0100.05314.74
5.3.230.0070.05014.68
5.3.220.0070.05314.48
5.3.210.0070.05714.48
5.3.200.0170.04014.57
5.3.190.0100.04714.73
5.3.180.0100.04714.74
5.3.170.0070.05314.56
5.3.160.0230.05314.79
5.3.150.0100.06314.70
5.3.140.0170.04014.64
5.3.130.0130.04714.55
5.3.120.0130.04714.63
5.3.110.0070.05714.65
5.3.100.0000.05314.26
5.3.90.0100.05713.92
5.3.80.0070.05314.04
5.3.70.0100.05014.09
5.3.60.0030.06713.97
5.3.50.0100.07014.04
5.3.40.0100.04714.04
5.3.30.0070.05014.00
5.3.20.0100.05313.68
5.3.10.0000.06313.81
5.3.00.0100.06713.71
5.2.170.0070.04311.23
5.2.160.0200.02311.13
5.2.150.0030.04311.14
5.2.140.0030.04310.97
5.2.130.0070.04011.11
5.2.120.0170.03011.18
5.2.110.0030.04310.93
5.2.100.0030.04311.19
5.2.90.0070.04311.16
5.2.80.0130.04011.15
5.2.70.0030.05711.18
5.2.60.0030.04311.13
5.2.50.0000.04711.02
5.2.40.0070.04011.22
5.2.30.0170.04310.98
5.2.20.0170.04010.97
5.2.10.0030.04710.82
5.2.00.0070.05310.81
5.1.60.0100.03010.15
5.1.50.0100.03710.09
5.1.40.0030.04010.02
5.1.30.0030.05310.42
5.1.20.0100.03310.34
5.1.10.0000.0439.91
5.1.00.0130.04010.16
5.0.50.0030.0308.58
5.0.40.0030.0438.38
5.0.30.0070.0438.32
5.0.20.0130.0278.16
5.0.10.0070.0278.03
5.0.00.0100.0408.14
4.4.90.0070.0206.86
4.4.80.0030.0306.86
4.4.70.0000.0276.86
4.4.60.0000.0236.86
4.4.50.0030.0206.86
4.4.40.0070.0336.86
4.4.30.0070.0236.86
4.4.20.0100.0176.86
4.4.10.0030.0306.86
4.4.00.0100.0336.86
4.3.110.0030.0206.86
4.3.100.0030.0306.86
4.3.90.0030.0276.86
4.3.80.0030.0336.86
4.3.70.0070.0206.86
4.3.60.0030.0206.86
4.3.50.0030.0206.85
4.3.40.0000.0336.85
4.3.30.0070.0206.85
4.3.20.0100.0176.85
4.3.10.0000.0276.85
4.3.00.0170.0206.71

preferences:
40.2 ms | 401 KiB | 5 Q