Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

integer bccomp(string left, string right, integer scale)


The bccomp function compares left to right. If they are equal, zero is returned. If left is
less than right, -1 is returned. If left is greater than right, 1 is returned.


<?
print(bccomp("12345","1.111111111111", 10));
?>


string bcdiv(string left, string right, integer scale)


Use bcdiv to divide left by right.


<?
print(bcdiv("12345", "98754", 10));
?>


string bcmod(string left, string right)


The bcmod function finds the modulus of the division of left by right.


<?
print(bcmod("66394593", "133347"));
?>


string bcmul(string left, string right, integer scale)


Use bcmul to multiply the left argument and the right argument.


<?
print(bcmul("66394593", "133347", 10));
?>


string bcpow(string value, string exponent, integer scale)


The bcpow function raises the value argument to the power of the exponent argument. If
the exponent is not an integer, the fractional part will be chopped off.

Free download pdf