3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getCombinedSum($digits, $sum) { if(!is_int($digits) || !is_int($sum) || $digits<1 || $sum<0) { throw new InvalidArgumentException('Invalid numeric format'); } if($sum>9*$digits) { throw new LogicException('Sum out of range'); } if($digits==1) { return [$sum]; } $result = []; for($digit=0; $digit<10 && $sum-$digit>0; $digit++) { foreach(getCombinedSum($digits-1, $sum-$digit) as $subsum) { $result[] = $digit.$subsum; $result[] = $subsum.$digit; } } return array_unique($result); } var_dump(getCombinedSum(3, 30));

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.40.0120.00918.81
8.3.30.0160.00020.32
8.3.20.0080.00020.13
8.3.10.0040.00421.09
8.3.00.0080.00022.51
8.2.170.0090.00622.96
8.2.160.0090.00622.25
8.2.150.0130.00724.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00420.80
8.2.110.0030.00619.27
8.2.100.0090.00317.91
8.2.90.0080.00019.21
8.2.80.0040.00418.04
8.2.70.0080.00317.59
8.2.60.0090.00017.80
8.2.50.0040.00418.07
8.2.40.0040.00418.28
8.2.30.0040.00419.36
8.2.20.0070.00017.73
8.2.10.0000.00717.67
8.2.00.0040.00417.77
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00323.80
8.1.230.0110.00021.04
8.1.220.0030.00618.77
8.1.210.0070.00019.09
8.1.200.0080.00017.35
8.1.190.0030.00517.52
8.1.180.0000.00818.10
8.1.170.0090.00018.63
8.1.160.0030.00618.82
8.1.150.0030.00518.46
8.1.140.0040.00417.38
8.1.130.0030.00617.69
8.1.120.0020.00517.41
8.1.110.0000.00817.38
8.1.100.0040.00417.31
8.1.90.0000.00717.30
8.1.80.0000.00717.43
8.1.70.0040.00417.36
8.1.60.0000.00917.54
8.1.50.0000.00717.53
8.1.40.0000.00817.51
8.1.30.0000.00717.46
8.1.20.0040.00417.49
8.1.10.0000.00817.57
8.1.00.0040.00417.45
8.0.300.0040.00419.85
8.0.290.0040.00417.18
8.0.280.0000.00718.45
8.0.270.0040.00417.27
8.0.260.0030.00316.89
8.0.250.0030.00616.99
8.0.240.0040.00416.94
8.0.230.0070.00017.07
8.0.220.0000.00716.99
8.0.210.0000.00716.94
8.0.200.0030.00316.91
8.0.190.0070.00017.00
8.0.180.0000.00716.98
8.0.170.0050.00316.88
8.0.160.0030.00316.92
8.0.150.0000.00716.88
8.0.140.0080.00016.96
8.0.130.0030.00313.42
8.0.120.0000.00716.86
8.0.110.0000.00816.91
8.0.100.0040.00416.93
8.0.90.0030.00516.96
8.0.80.0000.01616.94
8.0.70.0020.00516.77
8.0.60.0080.00016.88
8.0.50.0040.00416.79
8.0.30.0090.01016.95
8.0.20.0110.00817.40
8.0.10.0050.00217.00
8.0.00.0030.01516.82
7.4.330.0000.00516.81
7.4.320.0000.00716.55
7.4.300.0040.00416.52
7.4.290.0000.00816.48
7.4.280.0030.00516.53
7.4.270.0030.00316.45
7.4.260.0000.00613.17
7.4.250.0040.00416.35
7.4.240.0040.00316.51
7.4.230.0000.00716.43
7.4.220.0090.01016.52
7.4.210.0060.00916.48
7.4.200.0040.00416.58
7.4.190.0040.00416.54
7.4.160.0120.00316.52
7.4.150.0100.00717.40
7.4.140.0130.00317.86
7.4.130.0080.00816.43
7.4.120.0080.00916.73
7.4.110.0070.01016.52
7.4.100.0070.01016.68
7.4.90.0100.00716.47
7.4.80.0110.00519.39
7.4.70.0100.01316.40
7.4.60.0120.00416.56
7.4.50.0030.00616.20
7.4.40.0110.00722.77
7.4.30.0140.00316.43
7.4.10.0060.01115.45
7.4.00.0050.01315.28
7.3.330.0050.00013.19
7.3.320.0050.00013.31
7.3.310.0030.00616.35
7.3.300.0000.00716.23
7.3.290.0080.00816.36
7.3.280.0060.01116.30
7.3.270.0110.00717.40
7.3.260.0100.00818.24
7.3.250.0110.00716.51
7.3.240.0100.00716.39
7.3.230.0120.00616.63
7.3.210.0050.01116.55
7.3.200.0060.01519.39
7.3.190.0060.00916.66
7.3.180.0120.00516.58
7.3.170.0070.01116.38
7.3.160.0100.00716.55
7.3.130.0090.00815.36
7.3.120.0080.00815.37
7.3.110.0110.00615.28
7.3.100.0080.00515.30
7.3.90.0070.00915.38
7.3.80.0050.01015.28
7.3.70.0100.00415.33
7.3.60.0050.00915.42
7.3.50.0080.00715.23
7.3.40.0060.00715.34
7.3.30.0020.01015.35
7.3.20.0040.01017.12
7.3.10.0050.00817.08
7.3.00.0070.00817.08
7.2.330.0030.01316.76
7.2.320.0100.00716.75
7.2.310.0090.00916.71
7.2.300.0100.00616.51
7.2.290.0140.00616.78
7.2.260.0090.01015.42
7.2.250.0050.01415.53
7.2.240.0060.00815.71
7.2.230.0080.00515.27
7.2.220.0080.00615.51
7.2.210.0060.00615.50
7.2.200.0010.01315.52
7.2.190.0080.00415.50
7.2.180.0050.00715.55
7.2.170.0070.00715.48
7.2.160.0060.00815.45
7.2.150.0040.00917.43
7.2.140.0070.00717.37
7.2.130.0080.00817.40
7.2.120.0070.00817.42
7.2.110.0040.01117.47
7.2.100.0060.00917.45
7.2.90.0060.01017.36
7.2.80.0050.00817.33
7.2.70.0070.00717.34
7.2.60.0070.00617.28
7.2.50.0090.00417.54
7.2.40.0090.00517.47
7.2.30.0050.00817.48
7.2.20.0080.00817.42
7.2.10.0070.00717.33
7.2.00.0080.00417.44
7.1.330.0090.00716.31
7.1.320.0060.00716.25
7.1.310.0040.00616.23
7.1.300.0090.00516.21
7.1.290.0040.00716.31
7.1.280.0020.01016.29
7.1.270.0050.01016.35
7.1.260.0060.00716.20
7.1.250.0070.00616.20
7.1.240.0050.00816.31
7.1.230.0050.00816.32
7.1.220.0050.00816.32
7.1.210.0040.01016.33
7.1.200.0060.00716.16
7.1.190.0090.00416.29
7.1.180.0040.00716.23
7.1.170.0040.01116.17
7.1.160.0050.00816.16
7.1.150.0060.00616.25
7.1.140.0090.00316.33
7.1.130.0040.01216.35
7.1.120.0070.00516.24
7.1.110.0040.00816.36
7.1.100.0080.00716.75
7.1.90.0070.00716.23
7.1.80.0090.00516.21
7.1.70.0050.00516.36
7.1.60.0090.00717.00
7.1.50.0050.01016.47
7.1.40.0030.01116.27
7.1.30.0060.00816.28
7.1.20.0060.00816.30
7.1.10.0090.00716.25
7.1.00.0040.01617.85
7.0.330.0030.00815.90
7.0.320.0050.00715.97
7.0.310.0050.00916.04
7.0.300.0070.00415.92
7.0.290.0040.00916.04
7.0.280.0080.00416.00
7.0.270.0050.00716.06
7.0.260.0080.00515.88
7.0.250.0070.00716.02
7.0.240.0040.01115.94
7.0.230.0030.01115.97
7.0.220.0070.00516.03
7.0.210.0000.01415.86
7.0.200.0040.00716.21
7.0.190.0060.01015.90
7.0.180.0060.00715.95
7.0.170.0030.00915.95
7.0.160.0100.00415.98
7.0.150.0080.00616.01
7.0.140.0060.02717.45
7.0.130.0060.00615.96
7.0.120.0060.00715.90
7.0.110.0070.00615.96
7.0.100.0040.00915.91
7.0.90.0050.00815.89
7.0.80.0040.00615.96
7.0.70.0050.00815.94
7.0.60.0040.02817.02
7.0.50.0030.02716.40
7.0.40.0070.01515.56
7.0.30.0090.02415.50
7.0.20.0090.02415.66
7.0.10.0080.02115.45
7.0.00.0080.02115.55
5.6.400.0070.00714.98
5.6.390.0050.00914.70
5.6.380.0070.00814.92
5.6.370.0050.00914.90
5.6.360.0050.00914.83
5.6.350.0040.00814.73
5.6.340.0070.00614.79
5.6.330.0030.01114.84
5.6.320.0110.00414.92
5.6.310.0060.01014.76
5.6.300.0040.01114.76
5.6.290.0070.00914.97
5.6.280.0060.02216.50
5.6.270.0030.01314.77
5.6.260.0050.00815.02
5.6.250.0050.00915.05
5.6.240.0060.00714.83
5.6.230.0030.01014.87
5.6.220.0070.00514.90
5.6.210.0040.02016.25
5.6.200.0050.02415.79
5.6.190.0040.02416.21
5.6.180.0150.01816.23
5.6.170.0100.01816.18
5.6.160.0090.01316.25
5.6.150.0080.02115.74
5.6.140.0060.01415.73
5.6.130.0070.02515.57
5.6.120.0080.01316.34
5.6.110.0080.02816.33
5.6.100.0050.02016.26
5.6.90.0030.03016.28
5.6.80.0060.01916.23
5.6.70.0100.00614.77
5.6.60.0060.00614.74
5.6.50.0060.00614.69
5.6.40.0090.00414.81
5.6.30.0070.00914.70
5.6.20.0060.00714.59
5.6.10.0050.00914.62
5.6.00.0030.01014.71
5.5.380.0040.00914.79
5.5.370.0060.00814.71
5.5.360.0060.00614.78
5.5.350.0730.01316.23
5.5.340.0050.02715.51
5.5.330.0040.03116.13
5.5.320.0140.02216.14
5.5.310.0110.02616.21
5.5.300.0060.02315.59
5.5.290.0060.02515.53
5.5.280.0030.02316.32
5.5.270.0090.02516.35
5.5.260.0090.02416.20
5.5.250.0100.02216.21
5.5.240.0050.01816.15
5.5.230.0080.00614.78
5.5.220.0080.00614.72
5.5.210.0060.00714.63
5.5.200.0090.00514.77
5.5.190.0030.00914.66
5.5.180.0060.00914.72
5.5.170.0050.00914.78
5.5.160.0060.00514.70
5.5.150.0070.00714.72
5.5.140.0070.00714.71
5.5.130.0070.01014.81
5.5.120.0060.00814.63
5.5.110.0060.01014.74
5.5.100.0050.00814.81
5.5.90.0020.01014.66
5.5.80.0060.00714.83
5.5.70.0060.00614.71
5.5.60.0040.01014.80
5.5.50.0020.01014.77
5.5.40.0070.00414.60
5.5.30.0040.00814.69
5.5.20.0050.00814.79
5.5.10.0030.00914.50
5.5.00.0060.00714.63
5.4.450.0060.02613.79
5.4.440.0100.01713.74
5.4.430.0080.01613.77
5.4.420.0050.01713.75
5.4.410.0070.01813.67
5.4.400.0060.02113.65
5.4.390.0060.01413.61
5.4.380.0120.01713.75
5.4.370.0050.01513.63
5.4.360.0080.01213.63
5.4.350.0050.01413.67
5.4.340.0070.02313.62
5.4.330.0020.00811.92
5.4.320.0060.02613.71
5.4.310.0060.01713.77
5.4.300.0100.01813.67
5.4.290.0100.01813.76
5.4.280.0120.02113.73
5.4.270.0050.01913.64
5.4.260.0090.01513.61
5.4.250.0070.02313.72
5.4.240.0070.02413.60
5.4.230.0080.02413.69
5.4.220.0070.02013.73
5.4.210.0090.02113.70
5.4.200.0070.01813.57
5.4.190.0070.02213.64
5.4.180.0070.01813.76
5.4.170.0110.02013.62
5.4.160.0080.02413.58
5.4.150.0080.01813.71
5.4.140.0100.02213.00
5.4.130.0090.01313.02
5.4.120.0090.02313.02
5.4.110.0100.01713.01
5.4.100.0060.01412.99
5.4.90.0080.01613.03
5.4.80.0090.01912.97
5.4.70.0090.01613.04
5.4.60.0100.01413.01
5.4.50.0120.01413.01
5.4.40.0060.02212.99
5.4.30.0070.01413.04
5.4.20.0090.02312.93
5.4.10.0100.02313.04
5.4.00.0070.02112.86
5.3.290.0070.01512.67
5.3.280.0070.02312.60
5.3.270.0060.01712.62
5.3.260.0100.01412.59
5.3.250.0080.01512.56
5.3.240.0140.01812.60
5.3.230.0090.02112.62
5.3.220.0110.02212.61
5.3.210.0060.02512.65
5.3.200.0060.01512.57
5.3.190.0070.02512.60
5.3.180.0100.02012.60
5.3.170.0110.02012.62
5.3.160.0080.02312.66
5.3.150.0070.01612.58
5.3.140.0080.01712.56
5.3.130.0110.01912.60
5.3.120.0080.02312.56
5.3.110.0080.02112.58
5.3.100.0100.01812.50
5.3.90.0080.02212.48
5.3.80.0090.01912.39
5.3.70.0110.02012.39
5.3.60.0090.01212.45
5.3.50.0080.02212.39
5.3.40.0080.02312.50
5.3.30.0070.02112.45
5.3.20.0070.02312.34
5.3.10.0120.01612.30
5.3.00.0080.02312.26
5.2.170.0170.05712.11
5.2.160.0200.03312.11
5.2.150.0170.06012.11
5.2.140.0200.05712.11
5.2.130.0170.06012.11
5.2.120.0170.04012.11
5.2.110.0130.04012.11
5.2.100.0170.06012.11
5.2.90.0230.05312.11
5.2.80.0130.05312.11
5.2.70.0170.05312.11
5.2.60.0200.05012.11
5.2.50.0130.04012.11
5.2.40.0070.03312.11
5.2.30.0200.05712.11
5.2.20.0130.06012.11
5.2.10.0170.04712.11
5.2.00.0130.05712.11
5.1.60.0200.04012.11
5.1.50.0130.05312.11
5.1.40.0130.03312.11
5.1.30.0200.03712.11
5.1.20.0100.05712.11
5.1.10.0170.05012.11
5.1.00.0130.04712.11
5.0.50.0070.04012.11
5.0.40.0100.04312.11
5.0.30.0100.05312.11
5.0.20.0070.02712.11
5.0.10.0070.04012.11
5.0.00.0100.03012.11
4.4.90.0070.03712.11
4.4.80.0070.02012.11
4.4.70.0100.01712.11
4.4.60.0100.03312.11
4.4.50.0100.03312.11
4.4.40.0030.06012.11
4.4.30.0100.03712.11
4.4.20.0100.02012.11
4.4.10.0070.04012.11
4.4.00.0070.05712.11
4.3.110.0100.03012.11
4.3.100.0030.03312.11
4.3.90.0070.02712.11
4.3.80.0100.05312.11
4.3.70.0130.03012.11
4.3.60.0030.03012.11
4.3.50.0070.04012.11
4.3.40.0070.03712.11
4.3.30.0070.03712.11
4.3.20.0100.03012.11
4.3.10.0070.03312.11
4.3.00.0000.02312.11

preferences:
45.69 ms | 400 KiB | 5 Q