I l@ve RuBoard Previous Section Next Section

bcscale

string bcscale(int scale) 

scale

Number of decimal places to return

Sets scale.

Returns:

Always TRUE

Description:

bcscale() can be used with all BC math functions. It sets the default number of decimal places to return for all BC math functions if the scale is not passed as a parameter to the function. Naturally, if the number is defined in the function, the value in bcscale() is overridden.

Version:

Existing since version 3.0

Example:

Set scale to two decimal places
$num1 = "9912343.34546"; 
$num2 = "1"; 
echo bcmul($num1, $num2) . "\n"; 
// 2 decimal places 
bcscale(2); 
echo bcmul($num1, $num2); 

Output: 
9912343 
9912343.34 
    I l@ve RuBoard Previous Section Next Section