3v4l.org

run code in 300+ PHP versions simultaneously
<?php function roundDownToHalf($number) { $remainder = ($number * 10) % 10; $half = $remainder >= 5 ? 0.5 : 0; $value = floatval(intval($number) + $half); return number_format($value, 1, '.', ''); } print roundDownToHalf(4.9) . "\n"; print roundDownToHalf(4.8) . "\n"; print roundDownToHalf(4.5) . "\n"; print roundDownToHalf(3.8) . "\n"; print roundDownToHalf(2.3) . "\n"; print roundDownToHalf(1.0) . "\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.0140.00016.50
8.3.50.0170.00521.89
8.3.40.0070.00718.85
8.3.30.0070.00719.17
8.3.20.0040.00420.29
8.3.10.0050.00323.61
8.3.00.0060.00320.58
8.2.180.0100.00618.04
8.2.170.0110.00422.96
8.2.160.0070.00722.08
8.2.150.0080.00024.18
8.2.140.0090.00024.66
8.2.130.0080.00026.16
8.2.120.0030.00522.38
8.2.110.0030.00622.33
8.2.100.0060.00617.84
8.2.90.0080.00019.21
8.2.80.0000.00818.02
8.2.70.0000.00817.63
8.2.60.0040.00418.05
8.2.50.0060.00318.07
8.2.40.0040.00418.22
8.2.30.0050.00318.20
8.2.20.0030.00517.73
8.2.10.0060.00319.41
8.2.00.0030.00617.82
8.1.280.0080.00625.92
8.1.270.0050.00323.86
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00523.91
8.1.230.0000.01119.04
8.1.220.0030.00617.74
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0040.00417.29
8.1.180.0000.00818.10
8.1.170.0080.00018.78
8.1.160.0040.00422.05
8.1.150.0000.00718.62
8.1.140.0000.00717.40
8.1.130.0000.00717.77
8.1.120.0040.00417.48
8.1.110.0000.00717.53
8.1.100.0070.00317.57
8.1.90.0040.00417.56
8.1.80.0030.00317.52
8.1.70.0070.00017.34
8.1.60.0000.00817.53
8.1.50.0030.00517.62
8.1.40.0030.00517.50
8.1.30.0000.00817.59
8.1.20.0050.00217.66
8.1.10.0040.00817.62
8.1.00.0040.00417.48
8.0.300.0040.00418.77
8.0.290.0000.00717.14
8.0.280.0000.00718.52
8.0.270.0000.00717.25
8.0.260.0060.00016.85
8.0.250.0030.00316.93
8.0.240.0070.00017.00
8.0.230.0000.00717.06
8.0.220.0000.00716.94
8.0.210.0070.00016.90
8.0.200.0030.00316.87
8.0.190.0040.00416.99
8.0.180.0080.00016.89
8.0.170.0040.00416.86
8.0.160.0050.00216.86
8.0.150.0030.00316.88
8.0.140.0000.00716.84
8.0.130.0000.00613.38
8.0.120.0040.00416.95
8.0.110.0040.00416.86
8.0.100.0070.00016.86
8.0.90.0040.00416.76
8.0.80.0130.00716.84
8.0.70.0030.00516.95
8.0.60.0040.00417.01
8.0.50.0000.00717.03
8.0.30.0050.01317.33
8.0.20.0110.01117.40
8.0.10.0030.00517.05
8.0.00.0080.01016.71
7.4.330.0000.00515.07
7.4.320.0030.00316.57
7.4.300.0000.00616.55
7.4.290.0000.00716.68
7.4.280.0000.00716.54
7.4.270.0060.00016.50
7.4.260.0040.00416.61
7.4.250.0050.00216.63
7.4.240.0010.00616.62
7.4.230.0000.00716.57
7.4.220.0160.01016.74
7.4.210.0060.00716.56
7.4.200.0070.00016.60
7.4.190.0030.00316.82
7.4.160.0090.00916.62
7.4.150.0070.01717.40
7.4.140.0040.01417.86
7.4.130.0100.00716.53
7.4.120.0090.01116.51
7.4.110.0090.00916.57
7.4.100.0070.01416.50
7.4.90.0190.00716.55
7.4.80.0170.00716.65
7.4.70.0030.01716.64
7.4.60.0090.00616.56
7.4.50.0040.00416.50
7.4.40.0120.00322.77
7.4.30.0110.01116.59
7.4.00.0080.00815.12
7.3.330.0030.00313.38
7.3.320.0050.00013.33
7.3.310.0000.00716.54
7.3.300.0000.00616.37
7.3.290.0130.00316.36
7.3.280.0120.00416.36
7.3.270.0080.00917.40
7.3.260.0100.00716.80
7.3.250.0080.00816.33
7.3.240.0110.00616.65
7.3.230.0090.00616.66
7.3.210.0070.01016.29
7.3.200.0120.00619.39
7.3.190.0030.01316.69
7.3.180.0040.01416.61
7.3.170.0210.00316.61
7.3.160.0140.00416.42
7.3.120.0030.01314.69
7.3.110.0060.01014.77
7.3.100.0080.00815.04
7.3.90.0080.00714.68
7.3.80.0050.00914.69
7.3.70.0090.00414.61
7.3.60.0040.00914.91
7.3.50.0060.00614.71
7.3.40.0030.01014.73
7.3.30.0090.00714.66
7.3.20.0100.00516.58
7.3.10.0050.00916.57
7.3.00.0090.00516.67
7.2.330.0140.00416.48
7.2.320.0170.01016.79
7.2.310.0100.00616.52
7.2.300.0100.01016.40
7.2.290.0130.00316.59
7.2.250.0030.01315.21
7.2.240.0050.01114.95
7.2.230.0060.00715.00
7.2.220.0090.00315.29
7.2.210.0100.00615.13
7.2.200.0060.00714.90
7.2.190.0070.00815.11
7.2.180.0050.00914.91
7.2.170.0060.00914.99
7.2.160.0090.00614.86
7.2.150.0030.01016.64
7.2.140.0090.00316.93
7.2.130.0080.00616.56
7.2.120.0100.00316.76
7.2.110.0000.01816.93
7.2.100.0000.01616.88
7.2.90.0030.00916.90
7.2.80.0030.01216.81
7.2.70.0060.00916.82
7.2.60.0060.01016.96
7.2.50.0000.01317.00
7.2.40.0030.01416.86
7.2.30.0130.00316.92
7.2.20.0070.01016.82
7.2.10.0080.00816.90
7.2.00.0040.01018.22
7.1.330.0060.01015.81
7.1.320.0020.01215.79
7.1.310.0030.00915.99
7.1.300.0040.00915.81
7.1.290.0030.00815.70
7.1.280.0050.00915.66
7.1.270.0060.00715.63
7.1.260.0070.00615.65
7.1.250.0060.00615.84
7.1.100.0070.00418.14
7.1.70.0050.00217.19
7.1.60.0100.00716.95
7.1.50.0140.01017.02
7.1.00.0030.07722.27
7.0.200.0250.00416.36
7.0.140.0000.07021.92
7.0.60.0130.05719.93
7.0.50.0030.05717.88
7.0.40.0030.05020.02
7.0.30.0200.04320.24
7.0.20.0200.08020.22
7.0.10.0030.04720.19
7.0.00.0100.08320.09
5.6.280.0100.06720.91
5.6.210.0070.06020.72
5.6.200.0070.05318.23
5.6.190.0200.07320.47
5.6.180.0230.07720.78
5.6.170.0370.07720.44
5.6.160.0130.07720.54
5.6.150.0030.08318.29
5.6.140.0000.04318.18
5.6.130.0100.07718.18
5.6.120.0030.08321.13
5.6.110.0000.04321.12
5.6.100.0100.06721.11
5.6.90.0070.06320.96
5.6.80.0130.08020.52
5.5.350.4030.04020.32
5.5.340.0100.07317.97
5.5.330.0030.04320.27
5.5.320.0300.07320.34
5.5.310.0330.07720.43
5.5.300.0100.05717.96
5.5.290.0070.04017.99
5.5.280.0100.08020.87
5.5.270.0000.05720.81
5.5.260.0030.06020.86
5.5.250.0100.07720.71
5.5.240.0200.06320.35
5.4.450.0200.03719.62
5.4.440.0230.07319.59
5.4.430.0200.03719.56
5.4.420.0270.06719.41
5.4.410.0130.07319.57
5.4.400.0130.05019.08
5.4.390.0170.07719.38
5.4.380.0300.03319.06
5.4.370.0230.07019.06
5.4.360.0130.04319.37
5.4.350.0200.04319.27
5.4.340.0070.04719.16
5.4.320.0200.03319.21
5.4.310.0130.04019.38
5.4.300.0200.04019.22
5.4.290.0230.05319.14
5.4.280.0130.04019.29
5.4.270.0170.03719.08
5.4.260.0270.03319.08
5.4.250.0130.04018.98
5.4.240.0270.06319.08
5.4.230.0200.03718.88
5.4.220.0130.04319.08
5.4.210.0230.07019.08
5.4.200.0230.04019.28
5.4.190.0270.07019.20
5.4.180.0200.04719.06
5.4.170.0200.03319.08
5.4.160.0270.04018.98
5.4.150.0330.03318.94
5.4.140.0200.03716.57
5.4.130.0170.04016.40
5.4.120.0170.07716.38
5.4.110.0270.03716.47
5.4.100.0170.04316.51
5.4.90.0170.04016.50
5.4.80.0230.06716.32
5.4.70.0170.05016.40
5.4.60.0100.05016.56
5.4.50.0230.06316.23
5.4.40.0130.04016.56
5.4.30.0130.03716.57
5.4.20.0300.03316.52
5.4.10.0200.04016.39
5.4.00.0170.05015.78
5.3.290.0370.03014.77
5.3.280.0230.06714.72
5.3.270.0270.04014.71
5.3.260.0170.04714.75
5.3.250.0230.07314.61
5.3.240.0200.07314.59
5.3.230.0270.07014.71
5.3.220.0130.06314.53
5.3.210.0170.05014.69
5.3.200.0270.02314.56
5.3.190.0200.04314.64
5.3.180.0230.03314.68
5.3.170.0200.03314.54
5.3.160.0170.07314.53
5.3.150.0230.03014.55
5.3.140.0230.06014.78
5.3.130.0170.04714.60
5.3.120.0230.07314.60
5.3.110.0170.04014.52
5.3.100.0230.04314.01
5.3.90.0170.04314.18
5.3.80.0130.04314.07
5.3.70.0130.04013.93
5.3.60.0200.06713.93
5.3.50.0230.04014.05
5.3.40.0130.07713.92
5.3.30.0200.04014.02
5.3.20.0230.06313.70
5.3.10.0230.06713.58
5.3.00.0200.04013.73
5.2.170.0170.06012.66
5.2.160.0170.02712.66
5.2.150.0200.02712.66
5.2.140.0200.03712.66
5.2.130.0130.04012.66
5.2.120.0200.03712.66
5.2.110.0170.02312.66
5.2.100.0230.05312.66
5.2.90.0130.03312.66
5.2.80.0200.05712.66
5.2.70.0170.04012.66
5.2.60.0230.05712.66
5.2.50.0200.06012.66
5.2.40.0200.05312.66
5.2.30.0200.05312.66
5.2.20.0130.06312.66
5.2.10.0170.05312.66
5.2.00.0030.04012.66
5.1.60.0200.04712.66
5.1.50.0170.02312.66
5.1.40.0170.04712.66
5.1.30.0200.04012.66
5.1.20.0100.03312.66
5.1.10.0070.03012.66
5.1.00.0130.02712.66
5.0.50.0100.01712.66
5.0.40.0130.01312.66
5.0.30.0030.03712.66
5.0.20.0070.02312.66
5.0.10.0100.04012.66
5.0.00.0130.03312.66
4.4.90.0070.03712.66
4.4.80.0070.03312.66
4.4.70.0100.02712.66
4.4.60.0070.03312.66
4.4.50.0030.02712.66
4.4.40.0130.04712.66
4.4.30.0070.02012.66
4.4.20.0100.03012.66
4.4.10.0030.02712.66
4.4.00.0070.05712.66
4.3.110.0070.02312.66
4.3.100.0070.02712.66
4.3.90.0030.02012.66
4.3.80.0130.02312.66
4.3.70.0070.01312.66
4.3.60.0030.01712.66
4.3.50.0070.02712.66
4.3.40.0070.05012.66
4.3.30.0030.02312.66
4.3.20.0030.01712.66
4.3.10.0030.02012.66
4.3.00.0100.03312.66

preferences:
44.47 ms | 401 KiB | 5 Q