I l@ve RuBoard Previous Section Next Section

bcdiv

string bcdiv(string left_operand, string right_operand, [int scale]) 

left_operand

Number to divide

right_operand

Number to divide by

scale

Number of decimal places to return

Divides a value by another value.

Returns:

Division result

Description:

bcdiv() divides the first number by the second number and returns the result, formatted with a specified number of decimal places (optional).

Version:

Existing since version 3.0

Example:

Divide a large number
$num1 = "9912343.34546"; 
$num2 = "34546.9912343"; 
echo bcdiv($num2,$num1,10); 

Output: 
0.0034852496 
    I l@ve RuBoard Previous Section Next Section