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 = "123"; permute($str,0,2, 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.0100.01018.55
8.3.50.0080.00621.27
8.3.40.0100.00718.88
8.3.30.0140.00019.26
8.3.20.0080.00020.39
8.3.10.0000.00822.08
8.3.00.0040.00422.50
8.2.180.0070.00716.63
8.2.170.0070.00722.96
8.2.160.0000.01419.39
8.2.150.0050.00224.18
8.2.140.0060.00324.66
8.2.130.0000.00826.16
8.2.120.0070.00317.75
8.2.110.0090.00021.98
8.2.100.0070.00418.22
8.2.90.0000.00719.21
8.2.80.0060.00317.97
8.2.70.0030.00517.63
8.2.60.0030.00618.05
8.2.50.0040.00418.07
8.2.40.0030.00519.91
8.2.30.0000.00818.08
8.2.20.0050.00317.63
8.2.10.0040.00417.76
8.2.00.0000.00717.82
8.1.280.0100.00725.92
8.1.270.0030.00521.97
8.1.260.0000.00726.35
8.1.250.0080.00028.09
8.1.240.0030.00623.84
8.1.230.0080.00318.97
8.1.220.0040.00417.78
8.1.210.0030.00518.77
8.1.200.0000.00917.23
8.1.190.0030.00617.63
8.1.180.0060.00318.74
8.1.170.0000.00818.47
8.1.160.0040.00422.05
8.1.150.0040.00818.66
8.1.140.0020.00517.54
8.1.130.0000.00717.85
8.1.120.0000.00717.32
8.1.110.0000.00917.50
8.1.100.0040.00417.43
8.1.90.0030.00617.50
8.1.80.0000.00717.48
8.1.70.0030.00317.35
8.1.60.0030.00617.66
8.1.50.0030.00517.54
8.1.40.0070.00017.57
8.1.30.0040.00417.65
8.1.20.0030.00517.60
8.1.10.0000.00717.52
8.1.00.0060.00317.42
8.0.300.0050.00218.77
8.0.290.0000.00817.05
8.0.280.0000.00718.46
8.0.270.0070.00017.29
8.0.260.0030.00316.80
8.0.250.0000.00716.96
8.0.240.0030.00616.99
8.0.230.0000.00717.04
8.0.220.0000.00616.83
8.0.210.0000.00716.80
8.0.200.0030.00316.97
8.0.190.0000.00716.99
8.0.180.0000.00816.83
8.0.170.0040.00416.81
8.0.160.0000.00816.96
8.0.150.0070.00316.81
8.0.140.0000.00716.90
8.0.130.0060.00013.44
8.0.120.0040.00416.77
8.0.110.0000.00716.75
8.0.100.0030.00516.82
8.0.90.0040.00416.80
8.0.80.0110.00416.91
8.0.70.0070.00016.77
8.0.60.0050.00316.94
8.0.50.0040.00416.81
8.0.30.0090.01117.21
8.0.20.0140.00717.40
8.0.10.0040.00417.07
8.0.00.0130.00516.68
7.4.330.0000.00615.08
7.4.320.0060.00016.55
7.4.300.0030.00316.56
7.4.290.0000.00816.68
7.4.280.0000.00716.67
7.4.270.0030.00316.67
7.4.260.0000.00816.38
7.4.250.0040.00416.58
7.4.240.0020.00616.50
7.4.230.0000.00716.62
7.4.220.0090.00916.62
7.4.210.0050.01016.63
7.4.200.0070.00016.41
7.4.190.0030.00316.78
7.4.160.0060.00916.54
7.4.150.0070.01017.40
7.4.140.0140.00517.86
7.4.130.0080.00916.52
7.4.120.0090.00816.63
7.4.110.0060.01016.50
7.4.100.0180.00616.63
7.4.90.0100.01316.59
7.4.80.0170.00719.39
7.4.70.0140.00316.58
7.4.60.0080.01216.54
7.4.50.0030.00516.43
7.4.40.0070.01022.77
7.4.30.0130.00316.68
7.4.00.0050.00514.92
7.3.330.0000.00713.20
7.3.320.0030.00313.31
7.3.310.0030.00316.19
7.3.300.0000.00616.21
7.3.290.0110.00316.34
7.3.280.0100.00816.37
7.3.270.0070.01017.40
7.3.260.0170.00716.38
7.3.250.0130.00616.50
7.3.240.0040.01316.26
7.3.230.0110.00616.65
7.3.210.0100.00716.63
7.3.200.0060.01619.39
7.3.190.0030.01816.52
7.3.180.0030.01216.51
7.3.170.0040.01216.74
7.3.160.0100.00716.42
7.3.120.0050.00514.82
7.2.330.0100.01016.82
7.2.320.0120.00616.89
7.2.310.0130.00416.66
7.2.300.0090.00916.85
7.2.290.0070.01016.73
7.2.00.0070.00719.50
7.1.100.0070.00718.12
7.1.70.0040.00417.23
7.1.60.0140.01119.82
7.1.50.0070.01717.14
7.1.00.0100.06022.36
7.0.200.0040.00416.48
7.0.140.0000.07721.99
7.0.60.0300.07020.02
7.0.50.0100.08017.92
7.0.40.0130.06020.30
7.0.30.0300.04320.34
7.0.20.0230.06720.30
7.0.10.0100.04720.24
7.0.00.0030.08320.06
5.6.280.0070.07021.05
5.6.210.0070.08020.54
5.6.200.0200.07018.18
5.6.190.0200.04320.67
5.6.180.0230.03720.55
5.6.170.0230.07320.45
5.6.160.0100.04720.47
5.6.150.0070.04018.16
5.6.140.0130.07718.18
5.6.130.0100.07318.18
5.6.120.0030.04320.97
5.6.110.0070.08721.02
5.6.100.0100.03721.02
5.6.90.0170.07721.01
5.6.80.0030.05720.43
5.5.350.0170.04020.34
5.5.340.0070.03317.95
5.5.330.0030.08720.37
5.5.320.0400.06720.37
5.5.310.0370.04720.27
5.5.300.0070.07718.09
5.5.290.0000.04317.95
5.5.280.0130.08020.88
5.5.270.0100.09020.95
5.5.260.0070.07020.89
5.5.250.0070.08020.80
5.5.240.0230.06320.16
5.4.450.0930.06319.14
5.4.440.0630.05319.31
5.4.430.0770.06019.61
5.4.420.0770.05319.46
5.4.410.0870.08019.04
5.4.400.1100.06018.54
5.4.390.1230.07018.57
5.4.380.0270.05318.79
5.4.370.0170.05018.73
5.4.360.0200.04718.59
5.4.350.0170.05018.51
5.4.340.0200.04718.48
5.4.320.0070.03512.51
5.4.310.0050.05012.51
5.4.300.0060.03912.51
5.4.290.0080.03512.51
5.4.280.0060.03412.38
5.4.270.0020.03912.38
5.4.260.0040.04012.38
5.4.250.0060.03712.38
5.4.240.0070.03512.38
5.4.230.0040.04312.37
5.4.220.0030.03912.37
5.4.210.0070.03312.37
5.4.200.0060.03712.36
5.4.190.0060.03512.36
5.4.180.0030.03812.36
5.4.170.0090.03312.37
5.4.160.0070.03612.36
5.4.150.0080.03312.36
5.4.140.0070.03512.05
5.4.130.0040.03712.04
5.4.120.0030.03712.00
5.4.110.0050.03611.99
5.4.100.0040.03611.99
5.4.90.0050.04611.99
5.4.80.0060.04511.99
5.4.70.0050.03911.98
5.4.60.0030.03711.98
5.4.50.0070.03411.98
5.4.40.0050.03611.97
5.4.30.0070.03411.97
5.4.20.0090.03111.97
5.4.10.0050.03511.97
5.4.00.0030.03911.46
5.3.290.0080.03812.80
5.3.280.0050.03812.71
5.3.270.0100.03912.72
5.3.260.0060.03912.72
5.3.250.0090.03512.72
5.3.240.0050.03812.72
5.3.230.0030.04112.71
5.3.220.0080.03512.68
5.3.210.0030.04212.68
5.3.200.0050.04312.68
5.3.190.0120.03212.68
5.3.180.0050.03712.68
5.3.170.0070.03612.67
5.3.160.0040.03812.68
5.3.150.0040.03912.67
5.3.140.0050.03712.66
5.3.130.0040.04112.66
5.3.120.0060.04512.66
5.3.110.0060.05012.66
5.3.100.0030.03912.12
5.3.90.0020.04012.09
5.3.80.0060.03812.07
5.3.70.0070.03612.08
5.3.60.0050.03712.06
5.3.50.0110.04412.00
5.3.40.0060.04712.00
5.3.30.0120.04311.96
5.3.20.0080.03611.75
5.3.10.0050.03511.71
5.3.00.0070.03511.70
5.2.170.0040.0319.20
5.2.160.0070.0279.20
5.2.150.0060.0299.20
5.2.140.0030.0379.19
5.2.130.0030.0309.15
5.2.120.0030.0309.15
5.2.110.0050.0289.16
5.2.100.0070.0369.15
5.2.90.0070.0389.15
5.2.80.0070.0359.15
5.2.70.0060.0339.15
5.2.60.0050.0339.10
5.2.50.0020.0339.08
5.2.40.0040.0309.05
5.2.30.0030.0409.03
5.2.20.0010.0369.01
5.2.10.0070.0278.92
5.2.00.0050.0298.79
5.1.60.0060.0238.07
5.1.50.0020.0288.07
5.1.40.0020.0278.06
5.1.30.0040.0278.41
5.1.20.0040.0288.43
5.1.10.0040.0298.15
5.1.00.0030.0278.15
5.0.50.0010.0236.63
5.0.40.0060.0176.50
5.0.30.0030.0336.31
5.0.20.0060.0186.27
5.0.10.0050.0196.27
5.0.00.0020.0326.25
4.4.90.0030.0154.78
4.4.80.0050.0184.75
4.4.70.0000.0254.75
4.4.60.0040.0204.76
4.4.50.0040.0224.77
4.4.40.0020.0354.71
4.4.30.0020.0234.76
4.4.20.0020.0184.85
4.4.10.0010.0184.85
4.4.00.0040.0254.76
4.3.110.0010.0184.67
4.3.100.0030.0164.66
4.3.90.0030.0154.63
4.3.80.0030.0254.59
4.3.70.0020.0164.63
4.3.60.0030.0164.63
4.3.50.0050.0184.63
4.3.40.0030.0284.54
4.3.30.0020.0173.31
4.3.20.0030.0193.29
4.3.10.0020.0203.25
4.3.00.0100.0278.67

preferences:
37.69 ms | 401 KiB | 5 Q