3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = array('A','B','A'); permute($str, 0, count($str)); function permute($arr, $i, $n) { if ($i == $n) { printArray($arr); return; } for ($j = $i; $j < $n; $j += 1) { swapArrayValues($arr, $i, $j); permute($arr, $i + 1, $n); swapArrayValues($arr, $i, $j); } } function swapArrayValues(&$array, $i, $j) { $tmp = $array[$i]; $array[$i] = $array[$j]; $array[$j] = $tmp; } function printArray($arr) { echo implode($arr, ' ') . "\n"; }

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.0120.00318.43
8.3.50.0080.01421.14
8.3.40.0120.00318.67
8.3.30.0090.00618.84
8.3.20.0030.00518.86
8.3.10.0000.00821.04
8.3.00.0070.00021.85
8.2.180.0090.00616.88
8.2.170.0170.00322.96
8.2.160.0100.00320.52
8.2.150.0050.00324.18
8.2.140.0070.00024.66
8.2.130.0050.00226.16
8.2.120.0080.00019.54
8.2.110.0000.01119.31
8.2.100.0080.00417.84
8.2.90.0040.00419.21
8.2.80.0050.00318.04
8.2.70.0000.01117.38
8.2.60.0040.00417.80
8.2.50.0000.01218.07
8.2.40.0090.00018.28
8.2.30.0040.00419.43
8.2.20.0000.00717.84
8.2.10.0000.00817.88
8.2.00.0030.00617.88
8.1.280.0150.00425.92
8.1.270.0080.00024.66
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0040.00422.59
8.1.230.0040.00820.91
8.1.220.0040.00418.77
8.1.210.0000.00819.04
8.1.200.0000.00917.36
8.1.190.0040.00419.31
8.1.180.0060.00318.10
8.1.170.0040.00418.50
8.1.160.0050.00218.95
8.1.150.0080.00018.56
8.1.140.0050.00217.38
8.1.130.0030.00317.81
8.1.120.0030.00617.48
8.1.110.0040.00417.48
8.1.100.0000.00717.44
8.1.90.0020.00517.35
8.1.80.0000.00817.52
8.1.70.0070.00017.41
8.1.60.0030.00617.48
8.1.50.0050.00317.49
8.1.40.0040.00417.56
8.1.30.0000.00817.65
8.1.20.0040.00417.67
8.1.10.0050.00217.45
8.1.00.0050.00217.57
8.0.300.0100.00019.74
8.0.290.0070.00017.15
8.0.280.0070.00018.31
8.0.270.0000.00717.25
8.0.260.0060.00016.75
8.0.250.0050.00316.99
8.0.240.0050.00316.85
8.0.230.0050.00316.99
8.0.220.0040.00416.80
8.0.210.0000.00716.95
8.0.200.0030.00316.92
8.0.190.0070.00016.86
8.0.180.0050.00217.00
8.0.170.0040.00416.89
8.0.160.0000.00716.94
8.0.150.0080.00016.96
8.0.140.0040.00416.87
8.0.130.0060.00313.47
8.0.120.0030.00516.96
8.0.110.0030.00516.91
8.0.100.0020.00516.83
8.0.90.0030.00316.99
8.0.80.0120.00316.90
8.0.70.0050.00317.00
8.0.60.0040.00417.09
8.0.50.0030.00316.98
8.0.30.0090.01217.16
8.0.20.0090.01017.40
8.0.10.0020.00516.87
8.0.00.0120.00916.76
7.4.330.0000.00514.75
7.4.320.0000.00716.50
7.4.300.0030.00316.65
7.4.290.0030.00516.53
7.4.280.0030.00516.58
7.4.270.0020.00516.60
7.4.260.0030.00313.28
7.4.250.0000.00816.47
7.4.240.0030.00316.62
7.4.230.0040.00416.30
7.4.220.0150.00916.52
7.4.210.0040.01116.56
7.4.200.0040.00416.58
7.4.190.0050.00216.77
7.4.160.0120.00416.63
7.4.150.0150.00317.40
7.4.140.0090.00817.86
7.4.130.0120.00416.57
7.4.120.0100.00916.59
7.4.110.0140.00316.51
7.4.100.0100.01316.61
7.4.90.0030.01416.49
7.4.80.0000.02219.39
7.4.70.0100.00716.41
7.4.60.0120.00916.50
7.4.50.0030.00616.44
7.4.40.0040.00822.52
7.4.30.0120.00416.51
7.4.10.0080.00814.63
7.4.00.0060.01115.07
7.3.330.0050.00013.45
7.3.320.0030.00313.31
7.3.310.0030.00316.20
7.3.300.0030.00316.42
7.3.290.0050.01016.37
7.3.280.0080.00816.38
7.3.270.0070.01017.40
7.3.260.0100.01118.24
7.3.250.0110.00916.37
7.3.240.0090.00616.67
7.3.230.0090.00816.65
7.3.210.0060.01416.63
7.3.200.0050.01119.39
7.3.190.0110.01116.67
7.3.180.0030.01316.39
7.3.170.0160.00716.46
7.3.160.0060.00916.36
7.3.130.0030.01314.58
7.3.120.0100.00914.92
7.3.110.0090.00714.77
7.3.100.0060.00914.60
7.3.90.0080.00914.76
7.3.80.0070.00914.79
7.3.70.0080.00414.84
7.3.60.0110.00514.92
7.3.50.0040.00814.89
7.3.40.0050.00914.76
7.3.30.0040.00814.62
7.3.20.0100.00316.48
7.3.10.0070.00516.70
7.3.00.0050.00716.57
7.2.330.0090.00916.92
7.2.320.0100.01216.73
7.2.310.0100.00916.74
7.2.300.0030.01216.55
7.2.290.0090.00916.63
7.2.260.0030.01215.00
7.2.250.0070.01214.91
7.2.240.0080.00915.20
7.2.230.0050.01215.13
7.2.220.0080.00615.13
7.2.210.0060.00815.03
7.2.200.0070.01015.06
7.2.190.0070.00915.16
7.2.180.0110.00515.15
7.2.170.0050.00915.13
7.2.160.0030.01214.82
7.2.150.0000.01216.80
7.2.140.0060.00617.07
7.2.130.0060.00816.82
7.2.120.0130.00316.99
7.2.110.0070.00917.02
7.2.100.0030.00816.94
7.2.90.0060.00616.90
7.2.80.0060.00817.04
7.2.70.0040.01116.85
7.2.60.0020.01217.03
7.2.50.0000.01416.81
7.2.40.0090.00716.90
7.2.30.0090.00317.13
7.2.20.0070.00416.84
7.2.10.0080.00517.03
7.2.00.0030.01216.91
7.1.330.0020.01415.61
7.1.320.0070.00715.87
7.1.310.0100.00415.92
7.1.300.0080.01015.77
7.1.290.0050.01015.87
7.1.280.0090.00415.72
7.1.270.0060.00615.83
7.1.260.0070.00515.73
7.1.250.0090.00115.82
7.1.240.0060.00315.84
7.1.230.0070.00315.86
7.1.220.0040.01115.82
7.1.210.0060.00315.73
7.1.200.0090.00315.75
7.1.190.0040.01215.83
7.1.180.0040.01515.68
7.1.170.0070.00715.98
7.1.160.0040.00715.54
7.1.150.0000.01515.83
7.1.140.0060.00615.71
7.1.130.0080.00815.63
7.1.120.0030.01015.90
7.1.110.0100.00315.98
7.1.100.0080.00517.18
7.1.90.0070.00715.49
7.1.80.0040.00715.81
7.1.70.0020.00916.63
7.1.60.0020.00816.62
7.1.50.0110.00716.24
7.1.40.0030.00715.59
7.1.30.0090.00015.54
7.1.20.0060.00615.81
7.1.10.0030.01015.60
7.1.00.0070.04019.15
7.0.330.0060.00915.43
7.0.320.0030.00915.37
7.0.310.0030.00915.22
7.0.300.0030.00715.43
7.0.290.0080.00415.31
7.0.280.0070.00415.43
7.0.270.0110.00315.56
7.0.260.0060.00915.50
7.0.250.0030.01015.19
7.0.240.0090.00315.29
7.0.230.0040.01115.36
7.0.220.0070.00315.39
7.0.210.0000.01315.48
7.0.200.0000.01416.04
7.0.190.0060.00315.17
7.0.180.0000.01115.48
7.0.170.0100.00315.47
7.0.160.0060.00915.30
7.0.150.0040.01115.38
7.0.140.0090.03718.89
7.0.130.0100.00315.48
7.0.120.0000.01315.25
7.0.110.0060.00915.29
7.0.100.0030.00815.52
7.0.90.0070.00715.27
7.0.80.0000.01415.18
7.0.70.0070.03818.57
7.0.60.0050.04318.38
7.0.50.0060.04518.84
7.0.40.0100.03716.82
7.0.30.0070.04216.71
7.0.20.0070.03516.77
7.0.10.0020.05016.69
7.0.00.0060.04516.69
5.6.400.0030.01014.74
5.6.390.0120.00414.35
5.6.380.0000.01414.30
5.6.370.0070.00714.16
5.6.360.0030.01314.48
5.6.350.0120.00314.46
5.6.340.0000.00814.34
5.6.330.0090.00314.21
5.6.320.0030.00614.38
5.6.310.0090.00614.61
5.6.300.0040.00414.21
5.6.290.0070.00714.62
5.6.280.0100.00614.71
5.6.270.0070.00714.61
5.6.260.0030.00614.34
5.6.250.0060.00314.10
5.6.240.0030.01214.28
5.6.230.0090.00614.27
5.6.220.0050.04017.47
5.6.210.0070.03217.37
5.6.200.0030.05017.62
5.6.190.0070.04317.68
5.6.180.0010.04817.77
5.6.170.0100.04217.69
5.6.160.0030.03017.94
5.6.150.0020.04817.65
5.6.140.0090.04317.57
5.6.130.0080.02817.71
5.6.120.0100.04017.67
5.6.110.0060.04617.57
5.6.100.0050.04617.73
5.6.90.0100.04317.54
5.6.80.0050.04317.36
5.6.70.0060.04517.35
5.6.60.0080.03217.35
5.6.50.0050.04417.39
5.6.40.0100.03517.40
5.6.30.0080.04217.39
5.6.20.0100.03017.22
5.6.10.0060.04217.40
5.6.00.0080.03717.28
5.5.380.0050.00514.07
5.5.370.0060.01014.47
5.5.360.0070.04017.18
5.5.350.0010.03917.29
5.5.340.0020.03817.37
5.5.330.0080.02717.61
5.5.320.0050.02917.46
5.5.310.0040.04217.62
5.5.300.0060.03817.60
5.5.290.0030.04017.56
5.5.280.0030.04917.73
5.5.270.0050.03717.48
5.5.260.0030.04517.57
5.5.250.0050.03017.63
5.5.240.0050.03017.32
5.5.230.0100.04017.17
5.5.220.0050.03517.13
5.5.210.0070.04217.21
5.5.200.0040.02617.15
5.5.190.0090.03317.21
5.5.180.0080.04317.22
5.5.170.0140.00314.14
5.5.160.0050.04417.36
5.5.150.0070.02017.29
5.5.140.0030.03317.35
5.5.130.0050.03317.16
5.5.120.0000.02517.21
5.5.110.0030.02217.30
5.5.100.0020.02517.02
5.5.90.0070.02017.17
5.5.80.0070.01917.21
5.5.70.0050.02217.25
5.5.60.0050.02317.18
5.5.50.0050.02217.09
5.5.40.0050.02717.21
5.5.30.0030.02517.14
5.5.20.0030.04316.95
5.5.10.0100.03517.03
5.5.00.0050.01817.22
5.4.450.0030.04215.26
5.4.440.0070.04215.27
5.4.430.0050.04015.33
5.4.420.0080.04315.32
5.4.410.0070.02315.05
5.4.400.0000.02514.97
5.4.390.0020.04415.14
5.4.380.0040.04214.99
5.4.370.0030.03915.19
5.4.360.0020.04415.09
5.4.350.0040.04115.29
5.4.340.0070.02715.11
5.4.330.0030.00511.27
5.4.320.0050.04215.24
5.4.310.0030.04115.20
5.4.300.0000.02415.02
5.4.290.0040.02115.14
5.4.280.0040.02515.18
5.4.270.0030.02915.14
5.4.260.0020.02215.13
5.4.250.0080.01815.02
5.4.240.0000.02215.16
5.4.230.0010.02315.09
5.4.220.0070.01815.07
5.4.210.0020.02015.10
5.4.200.0050.03215.24
5.4.190.0000.02515.19
5.4.180.0000.02115.03
5.4.170.0020.02015.04
5.4.160.0020.02014.97
5.4.150.0030.02215.01
5.4.140.0020.02113.84
5.4.130.0030.02113.73
5.4.120.0050.01713.62
5.4.110.0050.01513.74
5.4.100.0020.02513.81
5.4.90.0050.02513.76
5.4.80.0020.01913.86
5.4.70.0030.02213.60
5.4.60.0030.02013.63
5.4.50.0060.02113.70
5.4.40.0050.03513.69
5.4.30.0080.02313.83
5.4.20.0010.02113.69
5.4.10.0030.03313.65
5.4.00.0030.02513.48
5.3.290.0030.02713.17
5.3.280.0020.02313.16
5.3.270.0030.02213.19
5.3.260.0050.02113.28
5.3.250.0030.02113.10
5.3.240.0030.01813.19
5.3.230.0030.02113.24
5.3.220.0020.02213.20
5.3.210.0040.02113.22
5.3.200.0000.02513.20
5.3.190.0050.02013.16
5.3.180.0030.01813.23
5.3.170.0030.01913.26
5.3.160.0030.01813.11
5.3.150.0060.01913.26
5.3.140.0050.03313.22
5.3.130.0030.02213.31
5.3.120.0040.02013.31
5.3.110.0040.02513.11
5.3.100.0050.02213.18
5.3.90.0030.02113.13
5.3.80.0060.01813.04
5.3.70.0000.02213.06
5.3.60.0030.01613.10
5.3.50.0070.01713.11
5.3.40.0000.02313.13
5.3.30.0030.01813.22
5.3.20.0020.01913.22
5.3.10.0060.01813.11
5.3.00.0040.01613.09
5.2.170.0000.03315.82
5.2.160.0000.02715.82
5.2.150.0030.02715.82
5.2.140.0030.02715.82
5.2.130.0000.04015.82
5.2.120.0000.04715.82
5.2.110.0000.03015.82
5.2.100.0000.04315.82
5.2.90.0000.02715.82
5.2.80.0030.02715.82
5.2.70.0100.03015.82
5.2.60.0000.03315.82
5.2.50.0000.04715.82
5.2.40.0070.05715.82
5.2.30.0030.06315.82
5.2.20.0030.04015.82
5.2.10.0070.02715.82
5.2.00.0030.06315.82
5.1.60.0000.04315.82
5.1.50.0070.04715.82
5.1.40.0030.03715.82
5.1.30.0030.04715.82
5.1.20.0030.05715.82
5.1.10.0030.04315.82
5.1.00.0030.03315.82
5.0.50.0030.03715.82
5.0.40.0030.04315.82
5.0.30.0000.06315.82
5.0.20.0000.04715.82
5.0.10.0100.04015.82
5.0.00.0000.06715.82
4.4.90.0030.03015.82
4.4.80.0000.02315.82
4.4.70.0000.03015.82
4.4.60.0000.03715.82
4.4.50.0070.03015.82
4.4.40.0070.05315.82
4.4.30.0030.02715.82
4.4.20.0030.03715.82
4.4.10.0000.03715.82
4.4.00.0030.06015.82
4.3.110.0000.03315.82
4.3.100.0000.03315.82
4.3.90.0000.03715.82
4.3.80.0000.03715.82
4.3.70.0100.02715.82
4.3.60.0000.03715.82
4.3.50.0000.03015.82
4.3.40.0000.05015.82
4.3.30.0030.03315.82
4.3.20.0000.03315.82
4.3.10.0070.03015.82
4.3.00.0070.03015.82

preferences:
49.95 ms | 401 KiB | 5 Q