Home > Backend Development > PHP Problem > Is bcadd php a function or an extension?

Is bcadd php a function or an extension?

藏色散人
Release: 2023-03-12 15:08:02
Original
2876 people have browsed it

bcadd is a function in PHP. Its function is to calculate the addition of two arbitrary precision numbers. The syntax of this function is such as "bcadd(string $num1, string $num2, ?int $scale = null): string".

Is bcadd php a function or an extension?

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

Is bcadd php a function or an extension?

bcadd is a function in php.

bcadd: Addition calculation of two arbitrary precision numbers

Description

bcadd(string $num1, string $num2, ?int $scale = null): string
Copy after login

Sum num1 and num2.

Parameters:

num, 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: Return the result of the sum of the two operands as a string.

Change log: 8.0.0 scale can now be null.

Example: bcadd() Example

<?php
$a = &#39;1.234&#39;;
$b = &#39;5&#39;;
echo bcadd($a, $b);     // 6
echo bcadd($a, $b, 4);  // 6.2340
?>
Copy after login

Related introduction:

bcsub() - Subtraction of two arbitrary precision numbers

Recommended learning:《PHP video tutorial

The above is the detailed content of Is bcadd php a function or an extension?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template