In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use bcsub in php". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use bcsub in php.
In PHP, the bcsub () function is used to subtract an arbitrary precision number from another function, which accepts two arbitrary precision numbers as strings and returns the subtraction of two numbers after zooming the result to the specified precision, with the syntax "bcsub ($num_str1,$num_str2,$scaleVal)".
This article operating environment: Windows10 system, PHP7.1 version, Dell G3 computer.
What is the use of bcsub in php
The bcsub () function in PHP is a built-in function that subtracts an arbitrary precision number from another function. This function accepts two arbitrary precision numbers as strings and returns the subtraction of two numbers after zooming the result to the specified precision.
Usage:
String bcsub ($num_str1, $num_str2, $scaleVal)
Parameters: this function accepts the three parameters shown in the above syntax and explains them below:
Num_str1: this parameter is of type string and represents the left Operand or one of the two numbers we want to subtract. This parameter is required.
Num_str2: this parameter is of string type and represents the right Operand or one of the two numbers we want to subtract. This parameter is required.
$scaleVal: this parameter is of type int and is optional. This parameter tells the number of digits that will appear after the decimal point of the addition result. The default value is zero.
Return value: this function returns the subtraction of the two numbers $num_str1 and $num_str2 as a string.
Example:
Input: $num_str1 = 11.222, $num_str2 = 3Output: 14Since the parameter $scaleVal is not specified sono digits after decimal is appeared in the result after subtraction.Input: $num_str1 = 11.222, $num_str2 = 3, $scaleVal = 4Output: 8.2220
The following example program is designed to illustrate the bcsub () function in PHP:
Program 1:
Output:
eight
At this point, I believe you have a deeper understanding of "how to use bcsub in php". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.