I l@ve RuBoard Previous Section Next Section

bcadd

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

left_operand

First number to be added

right_operand

Second number to be added

scale

Number of decimal places

Adds two numbers.

Returns:

Sum of two numbers

Description:

bcadd() adds two numbers and returns the result, formatted with a specified number of decimal places (optional). The input and output of this function can be integers, floating-point numbers, or a combination of both.

Version:

Existing since version 3.0

Example:

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

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