3v4l.org

run code in 300+ PHP versions simultaneously
<?php $leftOperand = '-0.00000000099999'; $modulus = '-0.00056'; $scale =14; bcscale($scale); //echo bcmod($leftOperand, $modulus); foreach( [ [4,3,1], [-4,3,2], [-4,-3,1], [4,-3,-2], [3,4,3], [-3,4,1], [-3,-4,1], [3,-4,-1], ] as $d) { echo "\r\nia $d[0] % $d[1] =".iaBcMod($d[0], $d[1], 0). " vs bcmod=".bcmod($d[0], $d[1])." vs wolfman=".$d[2]; } function iaBcMod($leftOperand, $modulus, $scale) { $frac = bcdiv($leftOperand, $modulus, $scale); if( $frac[0] === '-') { return bcsub( $leftOperand, bcmul($modulus, ceil($frac), $scale), $scale ); } return bcsub( $leftOperand, bcmul($modulus, floor($frac), $scale), $scale ); }

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.30.0130.00917.25
8.5.20.0150.00719.54
8.5.10.0130.00517.02
8.5.00.0160.00620.04
8.4.180.0160.00721.95
8.4.170.0090.01520.44
8.4.160.0030.00823.04
8.4.150.0090.00416.92
8.4.140.0120.00817.71
8.4.130.0120.00917.48
8.4.120.0080.00418.80
8.4.110.0110.00818.88
8.4.100.0150.00617.72
8.4.90.0100.01020.65
8.4.80.0160.00219.06
8.4.70.0060.01018.84
8.4.60.0050.00420.57
8.4.50.0140.00620.71
8.4.40.0180.00019.57
8.4.30.0070.01319.48
8.4.20.0130.00617.95
8.4.10.0120.00417.87
8.3.300.0130.00720.77
8.3.290.0090.01122.61
8.3.280.0140.00918.60
8.3.270.0160.00516.69
8.3.260.0060.00416.49
8.3.250.0120.00618.35
8.3.240.0050.00416.42
8.3.230.0110.00816.54
8.3.220.0060.00319.10
8.3.210.0110.00816.60
8.3.200.0070.00216.54
8.3.190.0080.00217.33
8.3.180.0120.00618.93
8.3.170.0100.00418.96
8.3.160.0120.00616.57
8.3.150.0150.00416.56
8.3.140.0030.00516.75
8.3.130.0000.01418.45
8.3.120.0080.00020.98
8.3.110.0120.00620.94
8.3.100.0180.00018.18
8.3.90.0110.00416.82
8.3.80.0030.00617.97
8.3.70.0100.01317.00
8.3.60.0000.01518.18
8.3.50.0080.00518.05
8.3.40.0090.00618.80
8.3.30.0100.00618.83
8.3.20.0030.00621.95
8.3.10.0050.00321.73
8.3.00.0040.00423.54
8.2.300.0160.00917.77
8.2.290.0130.00617.14
8.2.280.0120.00718.55
8.2.270.0120.00616.61
8.2.260.0040.00417.18
8.2.250.0060.00317.16
8.2.240.0060.01317.40
8.2.230.0050.00322.58
8.2.220.0030.00924.06
8.2.210.0100.00726.77
8.2.200.0090.00016.63
8.2.190.0070.01016.88
8.2.180.0110.00818.15
8.2.170.0120.00322.96
8.2.160.0060.00922.25
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0130.00619.48
8.2.110.0060.00322.30
8.2.100.0060.00617.91
8.2.90.0000.00918.28
8.2.80.0000.00919.95
8.2.70.0000.00817.80
8.2.60.0000.00917.93
8.2.50.0040.00418.16
8.2.40.0030.00519.35
8.2.30.0030.00621.14
8.2.20.0030.00618.15
8.2.10.0070.00018.10
8.2.00.0050.00518.08
8.1.340.0100.01117.77
8.1.330.0150.00316.22
8.1.320.0080.01117.89
8.1.310.0100.00317.03
8.1.300.0050.00318.05
8.1.290.0090.00018.88
8.1.280.0170.00325.92
8.1.270.0040.00423.71
8.1.260.0100.00626.35
8.1.250.0000.00828.09
8.1.240.0030.00723.92
8.1.230.0090.00322.73
8.1.220.0090.00017.74
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0040.00417.25
8.1.180.0040.00418.10
8.1.170.0000.00818.50
8.1.160.0040.00418.98
8.1.150.0040.00420.79
8.1.140.0050.00217.73
8.1.130.0000.00718.98
8.1.120.0040.00417.51
8.1.110.0050.00317.55
8.1.100.0040.00417.38
8.1.90.0000.00717.35
8.1.80.0050.00317.47
8.1.70.0030.00317.53
8.1.60.0030.00517.64
8.1.50.0030.00517.54
8.1.40.0080.00017.56
8.1.30.0040.00417.72
8.1.20.0040.00417.59
8.1.10.0040.00417.48
8.1.00.0040.00417.55
8.0.300.0050.00220.15
8.0.290.0030.00616.63
8.0.280.0030.00318.55
8.0.270.0070.00017.22
8.0.260.0000.00717.23
8.0.250.0030.00316.99
8.0.240.0060.00316.96
8.0.230.0040.00417.02
8.0.220.0000.00816.91
8.0.210.0030.00316.92
8.0.200.0030.00316.88
8.0.190.0050.00317.00
8.0.180.0030.00317.00
8.0.170.0030.00716.85
8.0.160.0070.00016.84
8.0.150.0080.00316.92
8.0.140.0040.00416.92
8.0.130.0030.00313.37
8.0.120.0030.00516.93
8.0.110.0040.00416.99
8.0.100.0000.00716.77
8.0.90.0000.00816.83
8.0.80.0000.01616.93
8.0.70.0080.00016.89
8.0.60.0040.00416.72
8.0.50.0000.00716.92
8.0.30.0130.00517.19
8.0.20.0090.01117.40
8.0.10.0050.00217.07
8.0.00.0140.00516.76
7.4.330.0000.00415.55
7.4.320.0000.00716.65
7.4.300.0040.00416.63
7.4.290.0030.00316.55
7.4.280.0070.00016.56
7.4.270.0000.00816.56
7.4.260.0070.00016.62
7.4.250.0000.00716.53
7.4.240.0000.00716.63
7.4.230.0030.00316.53
7.4.220.0080.00016.43
7.4.210.0050.00916.66
7.4.200.0000.00716.52
7.4.160.0090.01216.59
7.4.140.0110.00617.86
7.4.130.0150.00516.51
7.4.120.0060.01216.54
7.4.110.0070.01016.45
7.4.100.0070.01016.65
7.4.90.0130.00316.46
7.4.80.0160.00819.39
7.4.70.0090.00916.46
7.4.60.0030.01316.56
7.4.50.0070.01016.23
7.4.40.0120.00316.51
7.4.00.0040.00715.14
7.3.330.0000.00513.29
7.3.320.0050.00013.35
7.3.310.0050.00316.43
7.3.300.0030.00316.42
7.3.290.0000.00716.27
7.3.280.0130.00316.36
7.3.260.0080.00916.33
7.3.240.0100.00916.41
7.3.230.0060.01216.62
7.3.210.0150.00616.70
7.3.200.0060.01316.77
7.3.190.0110.00516.48
7.3.180.0030.01316.26
7.3.170.0130.00616.59
7.3.160.0060.01016.44
7.2.330.0090.01216.42
7.2.320.0110.01216.91
7.2.310.0160.00716.95
7.2.300.0080.01516.84
7.2.290.0080.00816.74
7.2.110.0350.00716.48
7.2.80.0270.00716.16
7.2.60.0120.00316.66
7.2.40.6110.02117.91
7.2.30.4690.01017.77
7.2.20.3690.01217.84
7.2.10.3440.01218.03
7.2.00.1860.00618.11
7.1.200.0000.01515.91
7.1.160.6840.02516.70
7.1.150.5520.01316.48
7.1.140.2570.01016.52
7.1.130.1770.01016.66
7.1.120.2150.01216.68
7.1.110.2640.00916.17
7.1.100.1410.01016.09
7.1.90.8920.02516.01
7.1.80.1620.01116.07
7.1.70.1830.01615.14
7.1.60.2410.01333.27
7.1.50.1140.01233.09
7.1.40.1490.01632.70
7.1.30.3130.01132.84
7.1.20.2440.00932.93
7.1.10.2280.00714.96
7.1.00.2540.01114.80

preferences:
53.93 ms | 1494 KiB | 5 Q