3v4l.org

run code in 300+ PHP versions simultaneously
<?php function decompose($value){ $value *= $value; $dp = array_fill(0,$value + 1,-1); $dp[1] = 1; for($i = 2; $i <= $value; ++$i){ for($j = intval( sqrt($i) ); $j >= 1; --$j){ if($dp[$i - $j * $j] != -1 && $dp[$i - $j * $j] < $j){ // meaning can be represented as sum of squares $dp[$i] = $j; break; // since we are looking for sequence with greater numbers } } } $result = []; $curr = $value; while($dp[$curr] != -1){ $result[] = $dp[$curr]; $curr -= $dp[$curr] * $dp[$curr]; } return $result; } print_r(decompose(11));

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.5.10.0100.00816.68
8.5.00.0130.00919.99
8.4.160.0140.00922.98
8.4.150.0020.00014.05
8.4.140.0130.00817.34
8.4.130.0100.01117.70
8.4.120.0100.00920.66
8.4.110.0100.00618.42
8.4.100.0100.01018.85
8.4.90.0100.00920.26
8.4.80.0080.00618.84
8.4.70.0110.00818.72
8.4.60.0040.00620.57
8.4.50.0120.00818.67
8.4.40.0040.01517.46
8.4.30.0000.00920.55
8.4.20.0120.00417.70
8.4.10.0140.00019.36
8.3.280.0110.01018.36
8.3.270.0170.01016.82
8.3.260.0140.00516.58
8.3.250.0050.00318.91
8.3.240.0080.00916.79
8.3.230.0120.00716.62
8.3.220.0110.00719.13
8.3.210.0100.00818.48
8.3.200.0040.00416.67
8.3.190.0130.00516.98
8.3.180.0100.00918.73
8.3.170.0070.00017.52
8.3.160.0150.00316.69
8.3.150.0090.01220.80
8.3.140.0140.00416.63
8.3.130.0050.00318.56
8.3.120.0090.00619.18
8.3.110.0060.00320.94
8.3.100.0030.00824.06
8.3.90.0080.00026.77
8.3.80.0100.00019.36
8.3.70.0090.00616.58
8.3.60.0070.01016.49
8.3.50.0090.00823.72
8.3.40.0120.00323.61
8.3.30.0140.00718.79
8.3.20.0080.00024.18
8.3.10.0050.00324.66
8.3.00.0000.00826.16
8.2.290.0060.00216.49
8.2.280.0120.00818.69
8.2.270.0070.01317.07
8.2.260.0000.00816.40
8.2.250.0050.00317.18
8.2.240.0090.00018.80
8.2.230.0090.00022.58
8.2.220.0040.00437.54
8.2.210.0080.00026.77
8.2.200.0090.00018.88
8.2.190.0040.01216.63
8.2.180.0070.01025.92
8.2.170.0040.01118.85
8.2.160.0090.00622.96
8.2.150.0090.00025.66
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0080.00419.89
8.2.110.0090.00022.26
8.2.100.0040.00817.72
8.2.90.0060.00317.75
8.2.80.0040.00418.92
8.2.70.0080.00648.69
8.2.60.0100.00448.74
8.2.50.0120.00248.71
8.2.40.0100.00449.38
8.2.30.0090.00449.31
8.2.20.0050.00748.73
8.2.10.0050.00749.26
8.2.00.0060.00549.32
8.1.330.0120.00315.78
8.1.320.0110.00716.21
8.1.310.0090.00916.81
8.1.300.0070.00319.86
8.1.290.0000.00930.84
8.1.280.0150.00325.92
8.1.270.0040.00423.99
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0060.00320.97
8.1.230.0070.00420.89
8.1.220.0040.00417.74
8.1.210.0090.00018.77
8.1.200.0100.00548.28
8.1.190.0110.00248.34
8.1.180.0100.00448.71
8.1.170.0100.00348.92
8.1.160.0020.01149.13
8.1.150.0110.00249.05
8.1.140.0060.00749.10
8.1.130.0080.00549.82
8.1.120.0060.00638.06
8.1.110.0080.00532.91
8.1.100.0090.00532.93
8.1.90.0080.00432.90
8.1.80.0080.00432.90
8.1.70.0070.00532.90
8.1.60.0080.00429.86
8.1.50.0070.00829.83
8.1.40.0130.00329.76
8.1.30.0100.00629.90
8.1.20.0120.00429.82
8.1.10.0110.00629.78
8.1.00.0090.00627.76
8.0.300.0080.00018.77
8.0.290.0050.00848.10
8.0.280.0040.00848.85
8.0.270.0080.00448.04
8.0.260.0100.00249.72
8.0.250.0150.00248.08
8.0.240.0100.00532.45
8.0.230.0100.00632.51
8.0.220.0070.00732.44
8.0.210.0090.00532.34
8.0.200.0050.00832.47
8.0.190.0070.00629.32
8.0.180.0090.00629.33
8.0.170.0090.00529.32
8.0.160.0110.00329.31
8.0.150.0110.00329.29
8.0.140.0100.00529.31
8.0.130.0090.00426.61
8.0.120.0070.00727.22
8.0.110.0070.00627.20
8.0.100.0090.00627.14
8.0.90.0130.00327.22
8.0.80.0090.00825.74
8.0.70.0100.00527.20
8.0.60.0110.00427.18
8.0.50.0080.00727.21
8.0.30.0110.00624.69
8.0.20.0110.00723.82
8.0.10.0120.00725.88
8.0.00.0080.00624.72
7.4.330.0030.00648.03
7.4.320.0080.00632.16
7.4.300.0110.00232.18
7.4.290.0090.00429.00
7.4.280.0120.00329.02
7.4.270.0100.00429.04
7.4.260.0090.00626.40
7.4.250.0090.00626.89
7.4.240.0090.00526.91
7.4.230.0110.00426.99
7.4.220.0080.00625.50
7.4.210.0080.00724.28
7.4.200.0110.00326.94
7.4.190.0120.00529.11
7.4.180.0140.00329.04
7.4.160.0090.00725.56
7.4.150.0100.00625.44
7.4.140.0110.00625.41
7.4.130.0090.00823.45
7.4.120.0110.00624.32
7.4.110.0120.00624.20
7.4.100.0100.00724.30
7.4.90.0120.00524.30
7.4.80.0110.00724.28
7.4.70.0110.00624.29
7.4.60.0130.00624.30
7.4.50.0120.00624.21
7.4.40.0100.00624.24
7.4.30.0100.00624.23
7.4.20.0110.00624.27
7.4.10.0080.00824.24
7.4.00.0120.00424.27
7.3.330.0090.00526.81
7.3.320.0110.00326.32
7.3.310.0110.00426.81
7.3.300.0100.00526.80
7.3.290.0090.00726.79
7.3.280.0130.00428.89
7.3.270.0120.00525.33
7.3.260.0110.00624.24
7.3.250.0100.00725.29
7.3.240.0110.00822.04
7.3.230.0100.00724.22
7.3.220.0120.00624.13
7.3.210.0110.00724.13
7.3.200.0120.00624.17
7.3.190.0130.00524.13
7.3.180.0100.00924.15
7.3.170.0120.00424.17
7.3.160.0090.00924.11
7.3.150.0140.00424.18
7.3.140.0120.00624.11
7.3.130.0090.00924.14
7.3.120.0110.00524.14
7.3.110.0120.00424.13
7.3.100.0110.00724.10
7.3.90.0090.00924.32
7.3.80.0110.00624.16
7.3.70.0130.00424.21
7.3.60.0120.00524.27
7.3.50.0100.00824.27
7.3.40.0130.00624.25
7.3.30.0120.00524.27
7.3.20.0150.00524.73
7.3.10.0170.00224.69
7.3.00.0130.00824.70
7.2.340.0140.00724.26
7.2.330.0160.00624.26
7.2.320.0140.00724.29
7.2.310.0170.00424.30
7.2.300.0160.00724.28
7.2.290.0150.00624.32
7.2.280.0140.00724.33
7.2.270.0150.00624.27
7.2.260.0140.00724.28
7.2.250.0130.00724.28
7.2.240.0140.00624.31
7.2.230.0140.00724.36
7.2.220.0140.00724.33
7.2.210.0130.00724.29
7.2.200.0130.00824.42
7.2.190.0130.00824.36
7.2.180.0130.00724.34
7.2.170.0150.00524.42
7.2.160.0170.00624.42
7.2.150.0130.00924.93
7.2.140.0130.00924.95
7.2.130.0210.00524.95
7.2.120.0150.00824.92
7.2.110.0180.00625.00
7.2.100.0160.00624.89
7.2.90.0160.00724.86
7.2.80.0150.00724.84
7.2.70.0150.00624.90
7.2.60.0160.00824.83
7.2.50.0170.00624.89
7.2.40.0150.00724.87
7.2.30.0180.00524.92
7.2.20.0150.00724.93
7.2.10.0170.00524.93
7.2.00.0160.00724.83

preferences:
135.77 ms | 403 KiB | 5 Q