3v4l.org

run code in 300+ PHP versions simultaneously
<?php function computeAllPermutations(array $words, array $separators): array { switch (count($words)) { case 0: return []; case 1: return [$words[0]]; default: $permutations = []; foreach (computeAllPermutations(array_slice($words, 1), $separators) as $subPermutation) { foreach ($separators as $separator) { $permutations[] = $words[0] . $separator . $subPermutation; } } return $permutations; } } $char = ["-", "_", "|", "+", "~"]; $MyString = "this is test string"; $words = preg_split('/\h+/', $MyString); print_r(computeAllPermutations($words, $char));

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.4.20.0100.01019.94
8.4.10.0090.00019.70
8.3.150.0140.00417.43
8.3.140.0120.00316.81
8.3.130.0040.00416.82
8.3.120.0000.00820.84
8.3.110.0090.00018.87
8.3.100.0000.01516.75
8.3.90.0080.00026.77
8.3.80.0040.00819.36
8.3.70.0170.00318.50
8.3.60.0120.00318.38
8.3.50.0100.00923.70
8.3.40.0100.01018.96
8.3.30.0080.00818.83
8.3.20.0080.00024.18
8.3.10.0000.00824.66
8.3.00.0040.00426.16
8.2.270.0130.00616.75
8.2.260.0100.01016.87
8.2.250.0070.00719.14
8.2.240.0030.00619.34
8.2.230.0080.00020.94
8.2.220.0090.00024.06
8.2.210.0040.00426.77
8.2.200.0090.00018.88
8.2.190.0090.00916.75
8.2.180.0100.01025.92
8.2.170.0080.00619.23
8.2.160.0040.01222.96
8.2.150.0040.00425.66
8.2.140.0160.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00421.00
8.2.110.0030.00721.23
8.2.100.0090.00318.03
8.2.90.0000.00817.72
8.2.80.0000.00819.04
8.2.70.0000.00817.71
8.2.60.0070.00317.87
8.2.50.0040.00418.05
8.2.40.0060.00319.95
8.2.30.0000.01018.18
8.2.20.0000.00718.18
8.2.10.0040.00419.38
8.2.00.0040.00419.27
8.1.310.0080.00016.78
8.1.300.0040.00418.33
8.1.290.0030.00630.84
8.1.280.0120.00925.92
8.1.270.0060.00323.99
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0040.00419.45
8.1.230.0040.00822.63
8.1.220.0060.00317.74
8.1.210.0030.00518.77
8.1.200.0090.00017.48
8.1.190.0040.00417.48
8.1.180.0080.00018.10
8.1.170.0030.00518.90
8.1.160.0050.00218.89
8.1.150.0040.00418.96
8.1.140.0040.00418.95
8.1.130.0000.00720.07
8.1.120.0000.00817.55
8.1.110.0040.00417.66
8.1.100.0040.00417.68
8.1.90.0040.00417.69
8.1.80.0000.00717.55
8.1.70.0050.00217.66
8.1.60.0080.00017.66
8.1.50.0000.00817.74
8.1.40.0040.00417.71
8.1.30.0080.00017.82
8.1.20.0080.00017.77
8.1.10.0030.00617.70
8.1.00.0030.00617.71
8.0.300.0000.00718.77
8.0.290.0040.00416.88
8.0.280.0030.00320.14
8.0.270.0030.00318.26
8.0.260.0030.00320.17
8.0.250.0070.00317.13
8.0.240.0000.00717.06
8.0.230.0030.00317.03
8.0.220.0000.00816.95
8.0.210.0070.00017.07
8.0.200.0060.00317.13
8.0.190.0000.00717.02
8.0.180.0040.00417.06
8.0.170.0030.00617.08
8.0.160.0080.00016.99
8.0.150.0040.00417.07
8.0.140.0070.00017.08
8.0.130.0030.00313.52
8.0.120.0000.00716.95
8.0.110.0040.00417.09
8.0.100.0040.00416.94
8.0.90.0040.00416.98
8.0.80.0080.00817.07
8.0.70.0040.00417.06
8.0.60.0000.00716.98
8.0.50.0030.00517.00
8.0.30.0160.00617.47
8.0.20.0040.01517.45
8.0.10.0050.00317.21
8.0.00.0100.01717.24
7.4.330.0020.00215.55
7.4.320.0000.00616.67
7.4.300.0030.00316.85
7.4.290.0050.00316.79
7.4.280.0040.00416.87
7.4.270.0050.00316.86
7.4.260.0000.00513.51
7.4.250.0000.00716.75
7.4.240.0040.00216.75
7.4.230.0000.00816.66
7.4.220.0000.00716.78
7.4.210.0100.00516.80
7.4.200.0070.00016.86
7.4.130.0110.00816.64
7.4.120.0140.00316.67
7.4.110.0090.00916.63
7.4.100.0100.01016.70
7.4.90.0060.01016.57
7.4.80.0130.00616.64
7.4.70.0110.00716.78
7.4.60.0070.01116.63
7.4.50.0100.01016.75
7.4.40.0070.01116.76
7.4.30.0120.00916.52
7.4.20.0110.00816.65
7.4.10.0070.01116.79
7.4.00.0130.01016.59
7.3.330.0000.00716.60
7.3.320.0030.00313.40
7.3.310.0030.00316.57
7.3.300.0000.00716.59
7.3.290.0100.00716.49
7.3.280.0110.00516.52
7.3.260.0110.00716.52
7.3.230.0100.00716.67
7.3.210.0030.01416.76
7.3.200.0120.00616.76
7.3.190.0060.01116.51
7.3.180.0120.00616.76
7.3.170.0110.01416.39
7.3.160.0030.01416.40
7.3.150.0120.00916.47
7.3.140.0100.01316.62
7.3.130.0030.01616.61
7.3.120.0120.00916.55
7.3.110.0090.00916.54
7.3.100.0140.00316.70
7.3.90.0090.01316.86
7.3.80.0120.00916.47
7.3.70.0070.01016.52
7.3.60.0000.01716.66
7.3.50.0070.01616.68
7.3.40.0130.00916.54
7.3.30.0120.00916.59
7.3.20.0200.00316.55
7.3.10.0100.01316.53
7.3.00.0040.01516.75
7.2.330.0120.00616.81
7.2.320.0060.01316.85
7.2.310.0060.01316.91
7.2.300.0090.00916.78
7.2.290.0130.00916.76
7.2.280.0090.01216.65
7.2.270.0000.01916.87
7.2.260.0200.00316.84
7.2.250.0110.01116.94
7.2.240.0160.00416.85
7.2.230.0150.00316.73
7.2.220.0110.01116.74
7.2.210.0110.00716.86
7.2.200.0070.01116.75
7.2.190.0160.00816.75
7.2.180.0030.01716.78
7.2.170.0070.01116.78
7.2.160.0170.00616.70
7.2.150.0140.01016.75
7.2.140.0090.00916.73
7.2.130.0190.00316.99
7.2.120.0040.01816.79
7.2.110.0110.01116.88
7.2.100.0120.00816.87
7.2.90.0070.01316.96
7.2.80.0090.01516.82
7.2.70.0310.03716.62
7.2.60.0320.03616.98
7.2.50.0420.03116.69
7.2.40.0280.02816.90
7.2.30.0180.03016.91
7.2.20.0160.01216.80
7.2.10.0440.01516.80
7.2.00.0100.01016.83

preferences:
14.53 ms | 403 KiB | 5 Q