Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
PHP – How to get the square root of an arbitrary precision number using bcsqrt() function?
In PHP, the bcsqrt() function is used to get the square root of an arbitrary precision number. It accepts the arbitrary precision number as a string and gives the square root of the number after scaling the result to the specified precision.
Syntax
string bcsqrt($num_string, $scale)
Parameters
The bcsqrt() function accepts two different parameters: $num_string and $scale.
$num_string − It represents the number whose square root to be evaluated. It is a string-type parameter.
$scale − It indicates the number of digits that appear after the decimal point in the output.
Return Value
The bcsqrt() function returns the square root of the number as a string.
Example 1
Output
Output without scale value: 4
Example 2
Output
Output with scale value: 4.690
Advertisements
