To find the square root of a number in PHP, you can use the sqrt()
function. This function takes a single parameter which is the number whose square root you want to find. Here's an example:
main.php119 chars4 lines
In this example, we assign the value 25 to the $number
variable. We then use the sqrt()
function to find the square root of the number and assign the result to the $sqrt
variable. Finally, we use an echo
statement to print out the result.
You can use this function to find the square root of any positive number in PHP.
gistlibby LogSnag