Home>Article>Backend Development> What is the usage of php bcadd
php bcadd is used for the addition calculation of two arbitrary precision numbers. Its usage syntax is "bcadd ( string $num1 , string $num2 , int|null $scale = null ) : string", which means that num1 and num2 summation.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
What is the usage of php bcadd?
bcadd — Addition of two arbitrary precision numbers
Description
bcadd ( string $num1 , string $num2 , int|null $scale = null ) : string
Sum num1 and num2.
Parameters
num1
Left operand, string type.
num2
Right operand, string type.
scale
This optional parameter is used to set the number of decimal places after the decimal point in the result. You can also set a global default number of decimal places for all functions by using bcscale(). If not set, defaults to 0.
Return value
Returns the result of the sum of the two operands as a string.
Change log
Version
8.0.0 Now scale can be null.
Example
Example #1 bcadd() Example
See
bcsub() - Subtraction of two arbitrary precision numbers
Recommended learning: "PHP video tutorial"
The above is the detailed content of What is the usage of php bcadd. For more information, please follow other related articles on the PHP Chinese website!