bcsqrt
string bcsqrt(string left_operand, [int scale])
left_operand | Number to calculate from |
scale | Number of decimal places to return |
Calculates square root.
Returns:
Square root of left operand
Description:
bcsqrt() calculates the square root of a given number and returns the result, formatted with a specified number of decimal places (optional).
Version:
Existing since version 3.0
Example:
Calculate the square root of a large number
$num1 = "9912343.21";
echo bcsqrt($num1, 3);
Output:
3148.387
|
Get PHP Functions Essential Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.