3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * take the range of characters and generate a string of all permutations * * @param array $range range of characters to itterate over * @param array $array input array - operated on by reference * @param int $depth how many chars to put in the resultant array should be * @param int $currentDepth internal variable to track how nested the current call is * @param string $prefix internal variable to know what to prefix the current string with * @return string permutations */ function foo($range, &$array, $depth = 1, $currentDepth = 0, $prefix = "") { $start = !$currentDepth; $currentDepth++; if ($currentDepth > $depth) { return; } foreach($range as $char) { if ($currentDepth === $depth) { $array[] = $prefix . $char; continue; } foo($range, $array, $depth, $currentDepth, $prefix . $char); } if ($start) { return implode($array, "\n"); } } $return = array(); echo foo(range('a', 'z'), $return, 2);

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.0070.01016.88
8.3.50.0100.00717.20
8.3.40.0130.00619.02
8.3.30.0030.01318.79
8.3.20.0040.00418.76
8.3.10.0050.00318.86
8.3.00.0080.00019.63
8.2.180.0140.00425.92
8.2.170.0060.01218.79
8.2.160.0110.00422.96
8.2.150.0050.00325.66
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0070.00020.87
8.2.110.0060.00320.58
8.2.100.0000.01218.03
8.2.90.0000.00818.03
8.2.80.0100.00017.97
8.2.70.0070.00317.50
8.2.60.0040.00417.75
8.2.50.0030.00617.93
8.2.40.0030.00519.75
8.2.30.0030.00918.22
8.2.20.0040.00717.66
8.2.10.0080.00017.79
8.2.00.0000.00817.81
8.1.280.0150.00325.92
8.1.270.0040.00424.66
8.1.260.0080.00026.35
8.1.250.0070.00728.09
8.1.240.0030.00720.94
8.1.230.0040.00722.81
8.1.220.0080.00017.79
8.1.210.0030.00918.77
8.1.200.0030.00617.48
8.1.190.0050.00317.25
8.1.180.0060.00318.10
8.1.170.0000.00817.62
8.1.160.0040.00422.21
8.1.150.0000.00818.70
8.1.140.0000.00717.55
8.1.130.0030.00317.95
8.1.120.0040.00317.60
8.1.110.0070.00017.54
8.1.100.0000.00717.53
8.1.90.0030.00517.54
8.1.80.0050.00317.48
8.1.70.0000.00817.44
8.1.60.0040.00417.63
8.1.50.0040.00417.46
8.1.40.0040.00417.52
8.1.30.0080.00017.54
8.1.20.0000.00817.72
8.1.10.0000.00817.53
8.1.00.0000.00817.43
8.0.300.0040.00420.02
8.0.290.0070.00016.75
8.0.280.0000.00818.42
8.0.270.0050.00318.24
8.0.260.0030.00316.94
8.0.250.0040.00417.08
8.0.240.0000.00717.11
8.0.230.0030.00317.11
8.0.220.0000.00817.01
8.0.210.0070.00016.95
8.0.200.0060.00016.95
8.0.190.0080.00017.06
8.0.180.0040.00417.07
8.0.170.0040.00416.98
8.0.160.0000.00816.98
8.0.150.0000.00917.08
8.0.140.0040.00416.93
8.0.130.0000.00513.48
8.0.120.0030.00516.93
8.0.110.0000.00716.88
8.0.100.0040.00416.96
8.0.90.0000.00816.88
8.0.80.0100.00616.94
8.0.70.0040.00416.88
8.0.60.0050.00316.91
8.0.50.0070.00016.82
8.0.30.0100.00617.31
8.0.20.0160.00317.29
8.0.10.0000.00817.15
8.0.00.0150.00817.00
7.4.330.0000.00513.04
7.4.320.0000.00616.57
7.4.300.0060.00016.55
7.4.290.0030.00316.61
7.4.280.0080.00016.64
7.4.270.0080.00016.58
7.4.260.0030.00313.31
7.4.250.0040.00416.54
7.4.240.0030.00516.55
7.4.230.0040.00416.74
7.4.220.0120.00616.54
7.4.210.0070.00816.65
7.4.200.0030.00316.57
7.4.190.0090.00016.57
7.4.160.0060.01216.36
7.4.150.0090.00916.51
7.4.140.0090.00916.49
7.4.130.0090.00916.69
7.4.120.0070.01716.52
7.4.110.0070.01116.54
7.4.100.0100.00716.66
7.4.90.0160.00016.59
7.4.80.0090.01319.39
7.4.70.0110.00816.63
7.4.60.0090.00816.53
7.4.50.0030.00316.43
7.4.40.0030.01316.46
7.4.30.0090.00916.54
7.4.00.0030.01215.10
7.3.330.0040.00413.38
7.3.320.0030.00313.27
7.3.310.0020.00516.45
7.3.300.0060.00016.30
7.3.290.0060.01116.46
7.3.280.0090.01016.44
7.3.270.0090.00816.46
7.3.260.0070.01116.62
7.3.250.0080.01316.52
7.3.240.0080.00816.71
7.3.230.0100.00716.38
7.3.210.0150.00316.38
7.3.200.0100.00616.58
7.3.190.0090.00616.59
7.3.180.0080.01016.71
7.3.170.0160.00016.68
7.3.160.0030.01616.48
7.3.120.0090.00615.06
7.2.330.0130.01316.91
7.2.320.0070.01016.75
7.2.310.0030.01716.70
7.2.300.0090.00916.77
7.2.290.0160.01016.85
7.2.60.0030.00916.82
7.2.00.0030.00919.02
7.1.200.0000.01615.92
7.1.100.0000.00918.15
7.1.70.0030.00717.35
7.1.60.0150.01119.30
7.1.50.0000.01116.87
7.1.00.0070.07322.50
7.0.200.0030.01016.83
7.0.140.0070.07022.00
7.0.60.0100.06319.98
7.0.50.0030.04717.91
7.0.40.0000.05720.16
7.0.30.0130.05020.11
7.0.20.0300.07320.24
7.0.10.0130.06720.06
7.0.00.0000.09020.09
5.6.210.0070.06720.65
5.6.200.0000.04318.20
5.6.190.0070.08720.38
5.6.180.0170.04720.67
5.6.170.0370.06720.71
5.6.160.0070.08720.71
5.6.150.0100.08018.19
5.6.140.0400.04718.40
5.6.130.0170.07018.21
5.6.120.0070.08321.07
5.6.110.0070.08320.93
5.6.100.0030.04021.02
5.6.90.0070.05021.14
5.6.80.0070.03720.41
5.5.350.0370.07020.44
5.5.340.0030.04017.94
5.5.330.0100.04720.55
5.5.320.0300.03020.28
5.5.310.0230.08020.51
5.5.300.0100.07718.08
5.5.290.0070.07017.97
5.5.280.0000.04320.84
5.5.270.0130.08020.80
5.5.260.0000.04320.91
5.5.250.0170.05320.69
5.5.240.0100.07720.07
5.4.450.0070.05019.18
5.4.440.0170.06019.25
5.4.430.0070.08019.47
5.4.420.0030.08019.18
5.4.410.0100.07719.22
5.4.400.0070.05318.84
5.4.390.0100.07718.94
5.4.380.0070.06019.17
5.4.370.0100.07319.08
5.4.360.0000.05019.25
5.4.350.0030.05319.25
5.4.340.0130.03719.25
5.4.320.0100.06719.21
5.4.310.0070.04019.15
5.4.300.0030.04719.14
5.4.290.0030.05319.14
5.4.280.0070.06719.24
5.4.270.0030.04019.00
5.4.260.0070.07019.14
5.4.250.0030.05019.15
5.4.240.0070.07719.14
5.4.230.0100.07719.23
5.4.220.0030.04719.16
5.4.210.0030.04019.11
5.4.200.0130.04319.24
5.4.190.0100.07718.84
5.4.180.0130.07318.91
5.4.170.0130.07318.91
5.4.160.0070.07719.18
5.4.150.0070.06319.05
5.4.140.0030.04716.40
5.4.130.0070.04716.46
5.4.120.0100.07316.46
5.4.110.0100.05016.32
5.4.100.0100.03316.48
5.4.90.0100.07716.46
5.4.80.0130.06016.57
5.4.70.0100.05016.34
5.4.60.0070.05016.56
5.4.50.0030.08016.43
5.4.40.0100.07316.46
5.4.30.0070.07016.45
5.4.20.0070.06016.51
5.4.10.0000.04716.49
5.4.00.0100.06316.01
5.3.290.0130.06714.74
5.3.280.0200.06314.78
5.3.270.0030.07014.82
5.3.260.0030.04314.85
5.3.250.0000.04714.95
5.3.240.0030.08014.68
5.3.230.0030.04714.83
5.3.220.0070.07014.80
5.3.210.0030.07014.67
5.3.200.0030.08014.80
5.3.190.0100.07314.93
5.3.180.0030.04314.79
5.3.170.0030.04314.75
5.3.160.0000.09014.77
5.3.150.0130.06714.80
5.3.140.0070.08014.77
5.3.130.0130.07314.79
5.3.120.0070.07014.62
5.3.110.0100.07714.75
5.3.100.0070.06714.26
5.3.90.0070.04714.21
5.3.80.0030.04014.12
5.3.70.0100.07314.20
5.3.60.0070.06014.23
5.3.50.0070.07314.15
5.3.40.0130.07014.05
5.3.30.0130.06314.04
5.3.20.0100.06713.78
5.3.10.0030.04313.91
5.3.00.0000.04313.98
5.2.170.0100.05311.34
5.2.160.0130.05711.38
5.2.150.0030.06711.28
5.2.140.0070.04311.48
5.2.130.0030.06311.27
5.2.120.0030.06311.43
5.2.110.0000.03311.36
5.2.100.0070.02711.23
5.2.90.0100.02311.35
5.2.80.0030.03011.32
5.2.70.0030.03011.32
5.2.60.0130.06011.15
5.2.50.0070.03311.23
5.2.40.0030.05311.14
5.2.30.0130.04711.14
5.2.20.0030.04711.18
5.2.10.0100.05711.00
5.2.00.0030.05011.06
5.1.60.0030.03710.25
5.1.50.0030.05310.23
5.1.40.0000.04310.18
5.1.30.0070.04710.73
5.1.20.0100.02710.59
5.1.10.0000.06310.30
5.1.00.0070.02310.45
5.0.50.0030.0478.79
5.0.40.0100.0278.66
5.0.30.0000.0708.52
5.0.20.0030.0308.45
5.0.10.0000.0308.41
5.0.00.0030.0338.31
4.4.90.0030.0137.79
4.4.80.0070.0177.79
4.4.70.0030.0237.79
4.4.60.0000.0207.80
4.4.50.0000.0177.81
4.4.40.0030.0537.85
4.4.30.0070.0337.88
4.4.20.0100.0277.91
4.4.10.0070.0337.93
4.4.00.0030.0477.93
4.3.110.0030.0307.93
4.3.100.0070.0337.93
4.3.90.0030.0377.93
4.3.80.0070.0507.93
4.3.70.0000.0237.93
4.3.60.0030.0307.93
4.3.50.0000.0377.93
4.3.40.0030.0537.93
4.3.30.0000.0337.93
4.3.20.0070.0337.93
4.3.10.0000.0407.93
4.3.00.0000.0377.93

preferences:
51.14 ms | 401 KiB | 5 Q