September 2001
Intermediate to advanced
768 pages
32h 45m
English
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:
$num1 = "9912343.34546";
$num2 = "1";
echo bcmul($num1, $num2) . "\n";
// 2 decimal places
bcscale(2);
echo bcmul($num1, $num2);
Output:
9912343
9912343.34
|
Read now
Unlock full access