The sqrt Function
The sqrt
function finds the square root
of a number.
Syntax
sqrt(number);
Example
Let's calculate the square root of 16
:
<?php
echo sqrt(16);
?>
Code execution result:
4
Example
Let's calculate the square root of 5
:
<?php
echo sqrt(5);
?>
Code execution result:
2.2360679774998
See Also
-
the
pow
function,
which raises a number to a power -
the lesson exponentiation,
which explains the**
operator -
the
round
function,
which rounds a number according to mathematical rules