Home>Article>Backend Development> What is the usage of php bcadd

What is the usage of php bcadd

藏色散人
藏色散人 Original
2021-06-15 10:03:42 5717browse

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.

What is the usage of php bcadd

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn