3v4l.org

run code in 300+ PHP versions simultaneously
<?php // function to generate and print all N! permutations of $str. (N = strlen($str)). function permute($str,$i,$n,$len) { global $ret; if ($i == $n){ if(in_array(substr($str,0,$len),$ret)==false){$ret[]=substr($str,0,$len);} }else { for ($j = $i; $j < $n; $j++) { swap($str,$i,$j); permute($str, $i+1, $n, $len); swap($str,$i,$j); // backtrack. } } } // function to swap the char at pos $i and $j of $str. function swap(&$str,$i,$j) { $temp = $str[$i]; $str[$i] = $str[$j]; $str[$j] = $temp; } $ret = array(); $str = "123456"; permute($str,0,strlen($str), 3); // call the function. ?>

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.01018.55
8.3.50.0110.00921.33
8.3.40.0140.01018.83
8.3.30.0090.00619.07
8.3.20.0120.00820.16
8.3.10.0090.00022.14
8.3.00.0000.00822.41
8.2.180.0070.01416.88
8.2.170.0100.00722.96
8.2.160.0120.00319.08
8.2.150.0030.00624.18
8.2.140.0060.00324.66
8.2.130.0090.00026.16
8.2.120.0030.00619.48
8.2.110.0120.01222.09
8.2.100.0120.00319.57
8.2.90.0030.00619.35
8.2.80.0030.00718.05
8.2.70.0000.01117.63
8.2.60.0030.00617.93
8.2.50.0000.01018.07
8.2.40.0060.00319.95
8.2.30.0040.00418.14
8.2.20.0040.00417.86
8.2.10.0030.00717.77
8.2.00.0030.00617.82
8.1.280.0150.00925.92
8.1.270.0150.00622.05
8.1.260.0060.00326.35
8.1.250.0070.00328.09
8.1.240.0060.00323.96
8.1.230.0100.00319.21
8.1.220.0030.00617.74
8.1.210.0000.00918.77
8.1.200.0070.00317.48
8.1.190.0000.00917.55
8.1.180.0030.00618.78
8.1.170.0030.00618.56
8.1.160.0030.00622.08
8.1.150.0100.00018.61
8.1.140.0090.00017.45
8.1.130.0000.00817.89
8.1.120.0060.00317.39
8.1.110.0060.00317.51
8.1.100.0000.00917.50
8.1.90.0090.00017.51
8.1.80.0000.00917.56
8.1.70.0000.00817.38
8.1.60.0060.00617.49
8.1.50.0060.00317.52
8.1.40.0000.00917.57
8.1.30.0090.00017.65
8.1.20.0060.00317.69
8.1.10.0000.00917.58
8.1.00.0030.00617.58
8.0.300.0060.00318.77
8.0.290.0030.00617.16
8.0.280.0030.00718.38
8.0.270.0030.00617.23
8.0.260.0050.00316.87
8.0.250.0030.00516.97
8.0.240.0000.00917.00
8.0.230.0030.00616.95
8.0.220.0030.00616.96
8.0.210.0080.00016.81
8.0.200.0040.00416.97
8.0.190.0030.00616.97
8.0.180.0000.00916.87
8.0.170.0050.00516.77
8.0.160.0000.01016.91
8.0.150.0030.00616.89
8.0.140.0090.00016.84
8.0.130.0040.00413.35
8.0.120.0050.00516.82
8.0.110.0030.00616.84
8.0.100.0000.00916.80
8.0.90.0030.00616.75
8.0.80.0140.00416.86
8.0.70.0000.00916.81
8.0.60.0060.00316.87
8.0.50.0000.00916.82
8.0.30.0080.01317.16
8.0.20.0080.01317.40
8.0.10.0030.00616.99
8.0.00.0100.01616.69
7.4.330.0070.00015.00
7.4.320.0040.00416.50
7.4.300.0070.00016.63
7.4.290.0030.00716.53
7.4.280.0000.00916.63
7.4.270.0000.00816.58
7.4.260.0060.00316.62
7.4.250.0000.01016.62
7.4.240.0020.00716.60
7.4.230.0040.00416.43
7.4.220.0110.01116.73
7.4.210.0120.00816.56
7.4.200.0060.00316.52
7.4.190.0060.00316.70
7.4.160.0090.00916.63
7.4.150.0160.00317.40
7.4.140.0120.01317.86
7.4.130.0180.00616.61
7.4.120.0050.01516.54
7.4.110.0240.01416.58
7.4.100.0130.01216.52
7.4.90.0060.01616.61
7.4.80.0060.02219.39
7.4.70.0060.01916.47
7.4.60.0100.01016.59
7.4.50.0030.00316.38
7.4.40.0030.01022.77
7.4.30.0100.01016.73
7.4.00.0030.00914.72
7.3.330.0050.00513.43
7.3.320.0040.00413.23
7.3.310.0030.00616.41
7.3.300.0000.00916.34
7.3.290.0030.01416.36
7.3.280.0100.01016.36
7.3.270.0080.01217.40
7.3.260.0110.00916.40
7.3.250.0140.01316.36
7.3.240.0150.00516.45
7.3.230.0030.01616.66
7.3.210.0120.00916.64
7.3.200.0080.01719.39
7.3.190.0130.01316.46
7.3.180.0110.00916.70
7.3.170.0030.01716.46
7.3.160.0060.01216.37
7.3.120.0070.01114.78
7.2.330.0170.00316.77
7.2.320.0080.01516.73
7.2.310.0110.01116.82
7.2.300.0230.02616.51
7.2.290.0070.01316.71
7.2.60.0030.01217.12
7.2.00.0030.01419.61
7.1.200.0100.00615.88
7.1.100.0060.00918.30
7.1.70.0000.01117.22
7.1.60.0170.01019.82
7.1.50.0180.00716.70
7.1.00.0030.03722.31
7.0.200.0000.01516.91
7.0.140.0000.08022.01
7.0.70.3330.04319.96
7.0.60.0030.05319.83
7.0.50.0030.04317.91
7.0.40.0070.06020.09
7.0.30.0170.09020.32
7.0.20.0470.06320.16
7.0.10.0300.06020.11
7.0.00.0100.06720.25
5.6.280.0030.10721.16
5.6.210.0100.09020.71
5.6.200.0030.05318.19
5.6.190.0100.08020.65
5.6.180.0430.06720.44
5.6.170.0370.04320.44
5.6.160.0100.08320.46
5.6.150.0070.05318.25
5.6.140.0030.04718.24
5.6.130.0100.08718.28
5.6.120.0000.07721.13
5.6.110.0070.04321.00
5.6.100.0100.08321.14
5.6.90.0070.09721.11
5.6.80.0000.05020.55
5.6.70.0230.08320.41
5.5.350.0070.06020.48
5.5.340.0030.08717.93
5.5.330.0070.04720.31
5.5.320.0000.04720.27
5.5.310.0200.05320.34
5.5.300.0130.08318.04
5.5.290.0030.04318.07
5.5.280.0100.08320.74
5.5.270.0100.04320.77
5.5.260.0100.08020.85
5.5.250.0030.09320.79
5.5.240.0100.04320.15
5.4.450.0870.09019.44
5.4.440.1070.06319.68
5.4.430.0700.07019.59
5.4.420.0800.08319.57
5.4.410.0870.06719.42
5.4.400.0500.06018.99
5.4.390.0130.07019.01
5.4.380.0230.05718.61
5.4.370.0370.06018.77
5.4.360.0430.06318.70
5.4.350.0070.04412.05
5.4.340.0070.05712.05
5.4.320.0110.04212.54
5.4.310.0070.04912.53
5.4.300.0040.04612.54
5.4.290.0060.05212.53
5.4.280.0050.04312.40
5.4.270.0070.04412.40
5.4.260.0060.04512.40
5.4.250.0070.04412.40
5.4.240.0080.04312.40
5.4.230.0060.04912.39
5.4.220.0050.04412.39
5.4.210.0040.04412.40
5.4.200.0070.04512.39
5.4.190.0070.05512.39
5.4.180.0100.05812.39
5.4.170.0080.06712.39
5.4.160.0060.05812.40
5.4.150.0070.05312.39
5.4.140.0060.04512.08
5.4.130.0090.04312.06
5.4.120.0060.04712.02
5.4.110.0070.04312.01
5.4.100.0080.04212.02
5.4.90.0060.04512.02
5.4.80.0050.04512.02
5.4.70.0060.04312.01
5.4.60.0070.04212.01
5.4.50.0070.04212.02
5.4.40.0120.04512.00
5.4.30.0050.05212.00
5.4.20.0040.04412.00
5.4.10.0040.04912.00
5.4.00.0050.04911.49
5.3.290.0070.04712.80
5.3.280.0070.04812.71
5.3.270.0070.04812.73
5.3.260.0040.04912.72
5.3.250.0060.04612.72
5.3.240.0050.05112.71
5.3.230.0080.04912.71
5.3.220.0090.04812.68
5.3.210.0050.05812.68
5.3.200.0070.04812.68
5.3.190.0070.04912.67
5.3.180.0090.05012.67
5.3.170.0150.05712.67
5.3.160.0070.05012.67
5.3.150.0100.06112.67
5.3.140.0040.04812.66
5.3.130.0050.04912.66
5.3.120.0080.05412.66
5.3.110.0060.04912.65
5.3.100.0080.04612.13
5.3.90.0070.04512.11
5.3.80.0060.04612.10
5.3.70.0060.04612.09
5.3.60.0040.04912.08
5.3.50.0070.04412.03
5.3.40.0110.05312.03
5.3.30.0050.04611.99
5.3.20.0060.04611.77
5.3.10.0110.04311.73
5.3.00.0070.04711.72
5.2.170.0030.0429.22
5.2.160.0030.0409.22
5.2.150.0070.0399.22
5.2.140.0060.0429.21
5.2.130.0080.0379.18
5.2.120.0060.0389.18
5.2.110.0050.0399.18
5.2.100.0060.0389.18
5.2.90.0030.0409.18
5.2.80.0030.0419.18
5.2.70.0080.0429.18
5.2.60.0030.0469.14
5.2.50.0010.0449.11
5.2.40.0040.0489.08
5.2.30.0040.0469.05
5.2.20.0060.0429.04
5.2.10.0070.0408.96
5.2.00.0020.0408.82
5.1.60.0080.0298.11
5.1.50.0060.0388.11
5.1.40.0050.0408.10
5.1.30.0080.0478.44
5.1.20.0070.0478.47
5.1.10.0040.0498.19
5.1.00.0070.0468.19
5.0.50.0080.0426.67
5.0.40.0030.0456.54
5.0.30.0030.0616.35
5.0.20.0030.0436.32
5.0.10.0040.0336.29
5.0.00.0060.0476.29
4.4.90.0030.0314.78
4.4.80.0070.0364.75
4.4.70.0020.0284.76
4.4.60.0020.0274.75
4.4.50.0040.0284.77
4.4.40.0030.0474.71
4.4.30.0030.0314.76
4.4.20.0020.0314.85
4.4.10.0040.0294.85
4.4.00.0050.0444.76
4.3.110.0040.0274.67
4.3.100.0020.0274.67
4.3.90.0020.0274.64
4.3.80.0030.0374.60
4.3.70.0010.0284.63
4.3.60.0050.0244.63
4.3.50.0040.0354.63
4.3.40.0030.0374.55
4.3.30.0030.0263.35
4.3.20.0010.0293.35
4.3.10.0020.0283.29
4.3.00.0170.0507.29

preferences:
29.29 ms | 401 KiB | 5 Q