3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bround($dVal,$iDec) { // banker's style rounding or round-half-even // (round down when even number is left of 5, otherwise round up) // $dVal is value to round // $iDec specifies number of decimal places to retain static $dFuzz=0.00001; // to deal with floating-point precision loss $iRoundup=0; // amount to round up by $iSign=($dVal!=0.0) ? intval($dVal/abs($dVal)) : 1; $dVal=abs($dVal); // get decimal digit in question and amount to right of it as a fraction $dWorking=$dVal*pow(10.0,$iDec+1)-floor($dVal*pow(10.0,$iDec))*10.0; $iEvenOddDigit=floor($dVal*pow(10.0,$iDec))-floor($dVal*pow(10.0,$iDec-1))*10.0; if (abs($dWorking-5.0)<$dFuzz) $iRoundup=($iEvenOddDigit & 1) ? 1 : 0; else $iRoundup=($dWorking>5.0) ? 1 : 0; return $iSign*((floor($dVal*pow(10.0,$iDec))+$iRoundup)/pow(10.0,$iDec)); } echo bround(10.005); ?>

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.00716.74
8.3.50.0110.00721.25
8.3.40.0160.00618.70
8.3.30.0090.00918.85
8.3.20.0040.00420.38
8.3.10.0000.00821.89
8.3.00.0040.00421.86
8.2.180.0040.01116.63
8.2.170.0140.00422.96
8.2.160.0110.00320.45
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0030.00618.81
8.2.120.0000.00826.35
8.2.110.0050.00521.10
8.2.100.0080.00317.80
8.2.90.0060.00319.05
8.2.80.0040.00417.97
8.2.70.0060.00317.50
8.2.60.0040.00417.92
8.2.50.0000.00818.09
8.2.40.0000.00820.36
8.2.30.0050.00219.45
8.2.20.0080.00017.76
8.2.10.0050.00317.93
8.2.00.0000.00818.14
8.1.280.0090.00925.92
8.1.270.0060.01322.14
8.1.260.0000.00728.09
8.1.250.0000.00728.09
8.1.240.0000.00922.48
8.1.230.0060.00617.68
8.1.220.0040.00417.76
8.1.210.0050.00318.77
8.1.200.0030.00717.23
8.1.190.0050.00317.23
8.1.180.0080.00018.10
8.1.170.0000.00818.59
8.1.160.0040.00420.61
8.1.150.0040.00420.48
8.1.140.0040.00419.50
8.1.130.0000.00717.57
8.1.120.0070.00017.35
8.1.110.0000.00717.24
8.1.100.0000.00717.37
8.1.90.0000.00717.43
8.1.80.0070.00017.38
8.1.70.0030.00317.40
8.1.60.0030.00617.45
8.1.50.0090.00017.44
8.1.40.0040.00817.48
8.1.30.0040.00417.60
8.1.20.0030.00617.58
8.1.10.0000.00717.51
8.1.00.0040.00417.41
8.0.300.0030.00518.77
8.0.290.0090.00016.63
8.0.280.0040.00418.46
8.0.270.0000.00717.21
8.0.260.0000.00717.22
8.0.250.0040.00416.87
8.0.240.0070.00016.97
8.0.230.0030.00316.89
8.0.220.0070.00017.00
8.0.210.0000.00716.91
8.0.200.0000.00616.89
8.0.190.0040.00416.96
8.0.180.0110.00016.99
8.0.170.0040.00416.95
8.0.160.0040.00417.02
8.0.150.0080.00016.87
8.0.140.0040.00416.91
8.0.130.0030.00313.38
8.0.120.0000.00716.83
8.0.110.0040.00416.96
8.0.100.0040.00416.89
8.0.90.0040.00416.83
8.0.80.0100.01316.88
8.0.70.0030.00516.91
8.0.60.0000.00816.74
8.0.50.0040.00416.94
8.0.30.0080.01016.86
8.0.20.0090.01117.40
8.0.10.0070.00016.98
8.0.00.0070.01316.65
7.4.330.0000.00516.83
7.4.320.0030.00316.47
7.4.300.0030.00316.39
7.4.290.0000.00716.38
7.4.280.0040.00416.51
7.4.270.0000.00816.48
7.4.260.0000.00716.44
7.4.250.0000.00816.44
7.4.240.0000.00716.40
7.4.230.0040.00316.46
7.4.220.0090.00916.50
7.4.210.0060.01216.63
7.4.200.0030.00316.60
7.4.160.0090.00616.28
7.4.150.0090.00917.40
7.4.140.0060.01117.86
7.4.130.0130.00316.45
7.4.120.0040.01216.49
7.4.110.0110.00816.57
7.4.100.0100.01016.58
7.4.90.0100.00716.38
7.4.80.0120.00919.39
7.4.70.0090.00916.49
7.4.60.0160.00316.43
7.4.50.0040.01116.49
7.4.40.0150.00616.41
7.4.30.0070.01116.52
7.4.00.0030.01315.01
7.3.330.0000.00613.24
7.3.320.0050.00013.24
7.3.310.0000.00716.35
7.3.300.0030.00316.28
7.3.290.0090.00716.29
7.3.280.0080.00916.31
7.3.270.0090.01317.40
7.3.260.0140.01016.57
7.3.250.0110.00516.44
7.3.240.0080.00916.43
7.3.230.0120.00916.39
7.3.210.0060.01216.41
7.3.200.0080.01319.39
7.3.190.0070.01616.48
7.3.180.0060.01216.42
7.3.170.0060.01216.58
7.3.160.0090.00916.30
7.3.120.0030.01314.93
7.3.110.0030.01214.86
7.3.100.0080.00914.68
7.3.90.0080.01014.79
7.3.80.0060.00714.72
7.3.70.0080.00414.83
7.3.60.0060.00714.77
7.3.50.0050.00914.80
7.3.40.0050.00914.71
7.3.30.0030.00814.73
7.3.20.0050.00816.45
7.3.10.0050.00716.51
7.3.00.0020.01316.59
7.2.330.0070.01516.73
7.2.320.0110.00716.63
7.2.310.0090.00616.63
7.2.300.0070.01016.70
7.2.290.0100.00716.59
7.2.250.0050.01114.88
7.2.240.0050.01415.14
7.2.230.0090.00914.85
7.2.220.0050.01214.92
7.2.210.0050.01214.86
7.2.200.0070.00814.73
7.2.190.0080.00814.86
7.2.180.0090.00314.89
7.2.170.0080.00714.90
7.2.60.0050.00516.77
7.2.00.0070.00519.32
7.1.330.0050.01115.51
7.1.320.0080.00415.62
7.1.310.0050.01015.57
7.1.300.0060.00615.51
7.1.290.0080.00515.30
7.1.280.0020.01015.61
7.1.270.0060.00615.56
7.1.260.0060.00815.57
7.1.200.0060.00315.44
7.1.100.0130.00017.86
7.1.70.0060.00916.81
7.1.60.0100.01419.40
7.1.50.0060.01616.88
7.1.00.0030.07322.28
7.0.200.0490.00314.92
7.0.60.0270.08020.15
7.0.50.0030.07318.12
7.0.40.0100.06320.27
7.0.30.0100.05320.52
7.0.20.0230.05020.23
7.0.10.0070.08720.50
7.0.00.0100.07320.24
5.6.280.0000.03321.02
5.6.210.0030.09320.75
5.6.200.0070.08318.41
5.6.190.0000.04720.73
5.6.180.0200.04020.75
5.6.170.0370.07320.68
5.6.160.0100.07020.64
5.6.150.0130.07018.25
5.6.140.0070.06718.30
5.6.130.0030.04018.38
5.6.120.0030.07721.38
5.6.110.0130.03721.21
5.6.100.0070.06321.12
5.6.90.0130.08321.36
5.6.80.0070.04320.68
5.5.350.0270.07320.61
5.5.340.0170.04318.22
5.5.330.0000.04720.33
5.5.320.0300.07020.38
5.5.310.0230.03720.49
5.5.300.0030.05018.27
5.5.290.0030.04318.08
5.5.280.0100.06721.20
5.5.270.0230.03021.04
5.5.260.0070.05320.95
5.5.250.0070.06720.96
5.5.240.0100.07020.43

preferences:
60.64 ms | 401 KiB | 5 Q