I l@ve RuBoard Previous Section Next Section

bcsub

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

left_operand

Number to subtract from

right_operand

Number to subtract

scale

Number of decimal places to return

Subtracts right operand from left operand.

Returns:

Subtracted number

Description:

bcsub() subtracts the second number from the first number and returns the result, formatted with a specified number of decimal places (optional).

Version:

Existing since version 3.0

Example:

Subtract two large numbers
$num1 = "9912343.34546"; 
$num2 = "34546.9912343"; 
echo bcsub($num1, $num2, 3); 

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