3v4l.org

run code in 300+ PHP versions simultaneously
<?php function permuteUnique($items, $perms = [], &$return = []) { if (empty($items)) { $return[] = $perms; } else { sort($items); $prev = false; for ($i = count($items) - 1; $i >= 0; --$i) { $newitems = $items; $tmp = array_splice($newitems, $i, 1)[0]; if ($tmp != $prev) { $prev = $tmp; $newperms = $perms; array_unshift($newperms, $tmp); permuteUnique($newitems, $newperms, $return); } } return $return; } } $permutations = permuteUnique([1, 2, 2, 3, 4, 4, 4, 4]); var_dump($permutations);

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.0300.00718.30
8.3.50.0270.01621.14
8.3.40.0200.01318.84
8.3.30.0100.02120.52
8.3.20.0080.00818.95
8.3.10.0100.00321.15
8.3.00.0100.00319.56
8.2.180.0190.01316.63
8.2.170.0320.00022.96
8.2.160.0140.01420.77
8.2.150.0120.00324.18
8.2.140.0120.00324.66
8.2.130.0180.00426.16
8.2.120.0040.01118.00
8.2.110.0150.00320.42
8.2.100.0150.00717.97
8.2.90.0030.01019.42
8.2.80.0090.00619.57
8.2.70.0080.00617.75
8.2.60.0080.00418.29
8.2.50.0090.00318.07
8.2.40.0090.00619.89
8.2.30.0030.01419.75
8.2.20.0110.00418.07
8.2.10.0030.00917.98
8.2.00.0080.00418.05
8.1.280.0250.00925.92
8.1.270.0190.01322.56
8.1.260.0070.00726.35
8.1.250.0100.00728.09
8.1.240.0200.01722.60
8.1.230.0130.01021.35
8.1.220.0070.00718.77
8.1.210.0080.00419.14
8.1.200.0130.00717.60
8.1.190.0110.00717.68
8.1.180.0110.00618.10
8.1.170.0000.01118.95
8.1.160.0000.01619.22
8.1.150.0150.00419.02
8.1.140.0070.01017.83
8.1.130.0070.00418.25
8.1.120.0120.00617.91
8.1.110.0100.00317.75
8.1.100.0100.00717.77
8.1.90.0030.01017.89
8.1.80.0110.00017.75
8.1.70.0030.00917.91
8.1.60.0070.00718.01
8.1.50.0060.00617.80
8.1.40.0070.00717.91
8.1.30.0070.00718.02
8.1.20.0070.00717.99
8.1.10.0030.01018.01
8.1.00.0080.00817.95
8.0.300.0090.00620.14
8.0.290.0080.00317.43
8.0.280.0090.00318.75
8.0.270.0070.00717.56
8.0.260.0040.00717.23
8.0.250.0040.01117.34
8.0.240.0040.00817.29
8.0.230.0090.00617.19
8.0.220.0150.00617.15
8.0.210.0060.00617.16
8.0.200.0090.00617.29
8.0.190.0000.01217.20
8.0.180.0110.00417.27
8.0.170.0090.00317.10
8.0.160.0160.01017.18
8.0.150.0060.00617.03
8.0.140.0060.00617.05
8.0.130.0070.00313.67
8.0.120.0080.00417.07
8.0.110.0060.00617.16
8.0.100.0000.01117.14
8.0.90.0000.01217.08
8.0.80.0280.03817.12
8.0.70.0080.00817.02
8.0.60.0030.01417.15
8.0.50.0000.01117.13
8.0.30.0510.02917.49
8.0.20.0560.03217.42
8.0.10.0060.00617.29
8.0.00.0340.02217.08
7.4.330.0040.00416.79
7.4.320.0120.00616.76
7.4.300.0040.00816.84
7.4.290.0040.00716.70
7.4.280.0090.00316.73
7.4.270.0000.01516.83
7.4.260.0110.00413.63
7.4.250.0100.00316.85
7.4.240.0000.01216.76
7.4.230.0090.00316.87
7.4.220.0100.03116.86
7.4.210.0210.03116.88
7.4.200.0060.00616.86
7.4.190.0040.00816.79
7.4.160.0370.02016.62
7.4.150.0580.03817.40
7.4.140.0540.02517.86
7.4.130.0510.01716.83
7.4.120.0500.02916.86
7.4.110.1070.05716.85
7.4.100.0590.03716.74
7.4.90.0730.03516.90
7.4.80.0450.03119.39
7.4.70.0460.03616.86
7.4.60.0220.02216.77
7.4.50.0040.00816.89
7.4.40.0220.02222.77
7.4.30.0220.01516.63
7.3.330.0080.00813.51
7.3.320.0100.00313.72
7.3.310.0040.01116.63
7.3.300.0040.00816.60
7.3.290.0270.01416.63
7.3.280.0190.03016.56
7.3.270.0200.02017.40
7.3.260.0560.02618.24
7.3.250.0340.02216.63
7.3.240.0660.03216.62
7.3.230.0450.02216.73
7.3.210.0870.02716.68
7.3.200.0250.04219.39
7.3.190.0640.03916.48
7.3.180.0430.02916.82
7.3.170.0220.02216.64
7.3.160.0340.02916.69
7.2.330.0240.02416.83
7.2.320.0360.02916.96
7.2.310.0720.05316.93
7.2.300.0460.02617.03
7.2.290.0400.02417.09
7.2.100.1520.00714.79
7.2.90.0600.01815.02
7.2.80.0890.02014.90
7.2.70.0750.01415.20
7.2.60.0370.01915.42
7.2.50.0760.02015.32
7.2.40.1020.01915.29
7.2.30.0960.02015.41
7.2.20.0670.00915.20
7.2.10.1090.02115.20
7.2.00.0730.01614.82
7.1.220.0570.01814.18
7.1.210.0290.01314.01
7.1.200.0510.02614.04
7.1.190.0830.00314.37
7.1.180.0770.01014.19
7.1.170.0860.00914.00
7.1.160.0880.02013.84
7.1.150.0810.00714.50
7.1.140.0650.01514.39
7.1.130.0860.01214.39
7.1.120.1160.01514.22
7.1.110.1450.01914.43
7.1.100.1110.02414.45
7.1.90.0850.01314.21
7.1.80.0220.02214.24
7.1.70.0940.01514.24
7.1.60.1010.02232.40
7.1.50.1060.01932.57
7.1.40.0580.01732.08
7.1.30.0690.00832.33
7.1.20.0760.01532.40
7.1.10.0950.01714.22
7.1.00.0300.01514.03
7.0.310.0340.01713.60
7.0.300.1360.01313.86
7.0.290.0870.01013.78
7.0.280.0770.01814.14
7.0.270.0760.00713.76
7.0.260.0720.01913.67
7.0.250.0710.01513.85
7.0.240.0930.01613.81
7.0.230.0280.02214.09
7.0.220.1340.02114.11
7.0.210.0370.00713.68
7.0.200.0920.01213.64
7.0.190.1110.00313.88
7.0.180.1030.01214.06
7.0.170.0410.01213.67
7.0.160.0910.01614.01
7.0.150.0270.01413.89
7.0.140.1120.00713.82
7.0.130.0810.01613.97
7.0.120.1030.01314.15
7.0.110.0450.01513.91
7.0.100.0360.00713.72
7.0.90.0600.01314.10
7.0.80.0290.01314.04
7.0.70.0630.01014.01
7.0.60.0440.01213.80
7.0.50.0340.02014.06
7.0.40.0430.01513.74
7.0.30.0820.01113.95
7.0.20.0310.01213.99
7.0.10.0470.01513.59
7.0.00.0610.01513.76
5.6.380.0230.00815.19
5.6.370.0130.02314.99
5.6.360.0390.02115.21
5.6.350.0360.01715.00
5.6.340.0140.04614.91
5.6.330.0130.01315.45
5.6.320.0160.01715.39
5.6.310.0160.02814.74
5.6.300.0160.01615.09
5.6.290.0290.01815.35
5.6.280.0310.01915.15
5.6.270.0130.01315.39
5.6.260.0330.01315.15
5.6.250.0150.02214.98
5.6.240.0270.01115.41
5.6.230.0190.02315.28
5.6.220.0180.02415.12
5.6.210.0460.03015.29
5.6.200.0330.02915.13
5.6.190.0250.02315.01
5.6.180.0140.01715.38
5.6.170.0430.01014.98
5.6.160.0150.01214.92
5.6.150.0570.01415.00
5.6.140.0280.02415.26
5.6.130.0300.01715.20
5.6.120.0340.01414.80
5.6.110.0300.03115.35
5.6.100.0120.02315.36
5.6.90.0280.01915.42
5.6.80.0250.01814.96
5.6.70.0290.02015.24
5.6.60.0350.02115.15
5.6.50.0290.02615.05
5.6.40.0250.02515.25
5.6.30.0300.01515.00
5.6.20.0350.01915.08
5.6.10.0270.01115.23
5.6.00.0210.00915.21
5.5.380.0250.02212.64
5.5.370.0380.01112.64
5.5.360.0220.02312.64
5.5.350.0180.02612.64
5.5.340.0260.01712.64
5.5.330.0300.01712.64
5.5.320.0190.01912.64
5.5.310.0190.02812.64
5.5.300.0350.01612.64
5.5.290.0250.01812.64
5.5.280.0160.01112.64
5.5.270.0110.01112.64
5.5.260.0170.02812.64
5.5.250.0140.01412.64
5.5.240.0310.01312.64
5.5.230.0330.01712.64
5.5.220.0130.03212.64
5.5.210.0240.02112.64
5.5.200.0360.02012.64
5.5.190.0290.02112.64
5.5.180.0190.00612.64
5.5.170.0410.01515.17
5.5.160.0340.01512.64
5.5.150.0150.02712.64
5.4.450.0400.01012.64
5.4.440.0210.02712.64
5.4.430.0190.02212.64
5.4.420.0170.03012.64
5.4.410.0200.02012.64
5.4.400.0110.01512.64
5.4.390.0150.02712.64
5.4.380.0240.03212.64
5.4.370.0280.01912.64
5.4.360.0360.01212.64
5.4.350.0360.03112.64
5.4.340.0460.01312.64
5.4.330.0230.03212.64
5.4.320.0220.01812.64
5.4.310.0420.01112.64
5.3.290.0050.00312.64

preferences:
33.05 ms | 401 KiB | 5 Q